Optimised Company() Setup() Config() and changed method_directory into URL

This commit is contained in:
Deon George 2013-02-12 22:14:59 +11:00
parent 97d894d472
commit 288d974cfa
63 changed files with 422 additions and 346 deletions

View File

@ -136,7 +136,7 @@ Kohana::modules(array_merge(Kohana::modules(),Config::modules()));
*/
Route::set('sections', '<directory>/<controller>(/<action>(/<id>(/<sid>)))',
array(
'directory' => '('.implode('|',Kohana::$config->load('config')->method_directory).')'
'directory' => '('.implode('|',array_values(URL::$method_directory)).')'
))
->defaults(array(
'action' => 'index',

View File

@ -30,7 +30,7 @@ class Auth_OSB extends Auth_ORM {
// If we are not a valid user object, then we are not logged in
if (is_object($user) AND $user instanceof Model_Account AND $user->loaded()) {
if (Config::sitemode() == Kohana::DEVELOPMENT && Kohana::$config->load('config')->site_debug)
if (Config::sitemode() == Kohana::DEVELOPMENT && Kohana::$config->load('debug')->site)
SystemMessage::add(array('title'=>'Debug','type'=>'debug','body'=>Kohana::debug(array('user'=>$user->username,'r'=>$role))));
if (! empty($role)) {
@ -257,7 +257,7 @@ class Auth_OSB extends Auth_ORM {
$sct = Kohana::$config->load('config')->session_change_trigger;
if (session_id() != $oldsess AND count($sct))
foreach ($sct as $t => $c)
if (Config::moduleexist($t))
if (Config::module_exist($t))
foreach (ORM::factory(ucwords($t))->where($c,'=',$oldsess)->find_all() as $o)
$o->set('session_id',session_id())
->update();

View File

@ -4,58 +4,127 @@
* This class is for access company information.
*
* @package OSB
* @subpackage System
* @subpackage Company
* @category Helpers
* @author Deon George
* @copyright (c) 2010 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
class Company {
// Our Company Setup object
private $so;
public function __construct(Model_Setup $so) {
$this->so = $so;
if (! $this->so->loaded())
throw new Kohana_Exception(_('Site [:site] not defined in DB?'),array(':site'=>URL::base('http')));
Kohana::$environment = (int)$this->so->status;
}
public static function instance() {
return new Company;
return new Company(ORM::factory('Setup',array('url'=>URL::base('http'))));
}
public static function name() {
return Config::instance()->so->site_details('name');
public function admin() {
return $this->so->account->name();
}
public static function street($ln='<br/>') {
if ($b = Config::instance()->so->site_details('address2'))
return implode($ln,array(Config::instance()->so->site_details('address1'),Config::instance()->so->site_details('address2')));
public function address($ln='<br/>') {
return implode($ln,array($this->street($ln),sprintf('%s, %s %s',$this->city(),$this->state(),$this->pcode())));
}
public function city() {
return $this->so->site_details('city');
}
public function contacts() {
return 'Tel: '.$this->phone();
}
public function country() {
return $this->so->country;
}
public function date_format() {
return $this->so->date_format;
}
public function decimals() {
return $this->so->decimal_place;
}
public function email() {
return $this->so->site_details('email');
}
public function fax() {
return $this->so->site_details('fax');
}
public function language() {
return $this->so->language->iso;
}
public function logo() {
return Config::logo();
}
public function logo_file() {
list ($path,$suffix) = explode('.',Config::$logo);
return ($x=Kohana::find_file(sprintf('media/site/%s',$this->site()),$path,$suffix)) ? $x : Kohana::find_file('media',$path,$suffix);
}
public function name() {
return $this->so->site_details('name');
}
public function module_config($item) {
return $this->so->module_config($item);
}
public function pcode() {
return $this->so->site_details('pcode');
}
public function phone() {
return $this->so->site_details('phone');
}
public function site($format=FALSE) {
return $format ? sprintf('%02s',$this->so->id) : $this->so->id;
}
public function so() {
return $this->so;
}
public function state() {
return $this->so->site_details('state');
}
public function street($ln='<br/>') {
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');
if (empty($mc['TAX_ID_NAME']))
return empty($mc['TAX_ID']) ? '' : $mc['TAX_ID'];
else
return Config::instance()->so->site_details('address1');
return sprintf('%s: %s',$mc['TAX_ID_NAME'],empty($mc['TAX_ID']) ? '' : $mc['TAX_ID']);
}
public static function city() {
return Config::instance()->so->site_details('city');
}
public static function state() {
return Config::instance()->so->site_details('state');
}
public static function pcode() {
return Config::instance()->so->site_details('pcode');
}
public static function address($ln='<br/>') {
return implode($ln,array(static::street($ln),sprintf('%s, %s %s',static::city(),static::state(),static::pcode())));
}
public static function phone() {
return Config::instance()->so->site_details('phone');
}
public static function fax() {
return Config::instance()->so->site_details('fax');
}
public static function email() {
return Config::instance()->so->site_details('email');
}
public static function contacts() {
return 'Tel: '.static::phone();
public function time_format() {
return $this->so->time_format;
}
public static function bsb() {
@ -67,37 +136,5 @@ class Company {
// @todo Details should be obtained from DB
return Kohana::$config->load('config')->accnum;
}
public static function taxid() {
// Tax ID details are stored in invoice config
$mc = Config::instance()->so->module_config('invoice');
if (empty($mc['TAX_ID_NAME']))
return empty($mc['TAX_ID']) ? '' : $mc['TAX_ID'];
else
return sprintf('%s: %s',$mc['TAX_ID_NAME'],empty($mc['TAX_ID']) ? '' : $mc['TAX_ID']);
}
public static function render() {
echo static::name();
echo static::address();
echo static::contacts();
}
/**
* Return the HTML to render the company address
*/
public function __toString() {
try {
return static::render();
}
// Display the exception message
catch (Exception $e) {
Kohana::exception_handler($e);
return '';
}
}
}
?>

View File

@ -11,10 +11,8 @@
* @license http://dev.osbill.net/license.html
*/
class Config extends Kohana_Config {
// Our setup object
public $so;
public static $no_site_id_tables = array('setup','country','currency','language','tax');
protected static $logo = 'img/logo-small.png';
// Our default logo, if there is no site logo
public static $logo = 'img/logo-small.png';
/**
* @compat Restore KH 3.1 functionality
@ -27,6 +25,7 @@ class Config extends Kohana_Config {
*
* At this point, KH hasnt been fully initialised either, so we cant rely on
* too many KH functions yet.
*
* NOTE: Kohana doesnt provide a parent construct for the Kohana_Config class.
*/
public function __construct() {
@ -59,10 +58,23 @@ class Config extends Kohana_Config {
return Config::$_instance;
}
/** Overloaded methods **/
/**
* 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();
}
public static function date($date) {
return date(Config::instance()->loadsite()->so->date_format,($date ? $date : time()));
return date(Company::instance()->date_format(),($date ? $date : time()));
}
/**
@ -73,38 +85,26 @@ class Config extends Kohana_Config {
return sprintf('%s %s',static::date($date),static::time($date));
}
public static function siteid($format=FALSE) {
return $format ? sprintf('%02s',Config::instance()->loadsite()->so->id) : Config::instance()->loadsite()->so->id;
public static function language() {
return Company::instance()->language();
}
public static function sitemode() {
return Config::instance()->loadsite()->so->status;
}
public static function time($date) {
return date(Config::instance()->loadsite()->so->time_format,($date ? $date : time()));
}
/** Local Methods **/
/**
* Load our site configuration from the DB
*
* We cant do this in __construct(), since Kohana hasn't been fully initialised yet.
* The URI to show for the login prompt.
* Normally if the user is logged in, we can replace it with a user edit call, instead of login
*/
public function loadsite() {
// Anti-loop, if we have loaded our record, just return;
if ($this->so AND $this->so->loaded())
return $this;
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'));
}
$this->so = ORM::factory('Setup',array('url'=>URL::base('http')));
public static function logo() {
return HTML::image(static::logo_uri(),array('class'=>'headlogo','alt'=>_('Logo')));
}
if (! $this->so->loaded())
throw new Kohana_Exception(_('Site [:site] not defined in DB?'),array(':site'=>URL::base('http')));
public static function logo_uri() {
list ($path,$suffix) = explode('.',static::$logo);
Kohana::$environment = (int)static::sitemode();
return $this;
return URL::site(Route::get('default/media')->uri(array('file'=>$path.'.'.$suffix),array('alt'=>static::sitename())),'http');
}
/**
@ -123,66 +123,24 @@ class Config extends Kohana_Config {
return $return;
}
public static function moduleexist($module) {
public static function module_config($item) {
return Company::instance()->module_config($item);
}
public static function module_exist($module) {
return array_key_exists(strtolower($module),static::modules()) ? TRUE : FALSE;
}
public static function copywrite() {
return '(c) Open Source Billing Development Team';
}
/**
* Return our site name
*/
public static function site() {
return $_SERVER['SERVER_NAME'];
}
public static function sitemodeverbose() {
$modes = array(
Kohana::PRODUCTION=>'Production',
Kohana::STAGING=>'Staging',
Kohana::TESTING=>'Testing',
Kohana::DEVELOPMENT=>'Development',
);
return (! isset($modes[static::sitemode()])) ? 'Unknown' : $modes[static::sitemode()];
}
public static function submode() {
$submode = Kohana::$config->load('config.debug.submode');
return (isset($submode[Request::$client_ip])) ? $submode[Request::$client_ip] : FALSE;
public static function siteid($format=FALSE) {
return Company::instance()->site($format);
}
public static function sitename() {
return Kohana::$config->load('config')->site_name;
return Company::instance()->name();
}
// Called in Invoice/Emailing to embed the file.
public static function logo_file() {
list ($path,$suffix) = explode('.',static::$logo);
return ($a=Kohana::find_file(sprintf('media/site/%s',Config::siteid()),$path,$suffix)) ? $a : Kohana::find_file('media',$path,$suffix);
}
public static function logo_uri() {
list ($path,$suffix) = explode('.',static::$logo);
return URL::site(Route::get('default/media')->uri(array('file'=>$path.'.'.$suffix),array('alt'=>static::sitename())),'http');
}
public static function logo() {
return HTML::image(static::logo_uri(),array('class'=>'headlogo','alt'=>_('Logo')));
}
public static function login_uri() {
return ($ao = Auth::instance()->get_user() AND is_object($ao)) ? HTML::anchor('user/account/edit',$ao->name()) : HTML::anchor('login',_('Login'));
}
/**
* 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 sitemode() {
return Company::instance()->sitemode();
}
/**
@ -203,5 +161,9 @@ class Config extends Kohana_Config {
public static function theme() {
return Kohana::$config->load('config')->theme;
}
public static function time($date) {
return date(Company::instance()->time_format(),($date ? $date : time()));
}
}
?>

View File

@ -60,7 +60,7 @@ class Controller_Admin_Account extends Controller_TemplateDefault_Admin {
ORM::factory('Account')->list_active(),
25,
array(
'id'=>array('label'=>'ID','url'=>'user/account/view/'),
'id'=>array('label'=>'ID','url'=>URL::link('user','account/view/')),
'accnum()'=>array('label'=>'Num'),
'name(TRUE)'=>array('label'=>'Account'),
'email'=>array('label'=>'Email'),
@ -70,7 +70,7 @@ class Controller_Admin_Account extends Controller_TemplateDefault_Admin {
array(
'page'=>TRUE,
'type'=>'select',
'form'=>'user/account/view',
'form'=>URL::link('user','account/view'),
)),
));
}

View File

@ -26,7 +26,7 @@ class Controller_Admin_Module extends Controller_TemplateDefault_Admin {
$methods = array();
// List of classes where all our methods are, including this one.
$classes = Kohana::$config->load('config')->method_directory;
$classes = URL::$method_directory;
array_unshift($classes,'');
foreach ($classes as $c) {
@ -56,7 +56,7 @@ class Controller_Admin_Module extends Controller_TemplateDefault_Admin {
$mo->find_all(),
25,
array(
'id'=>array('label'=>'ID','url'=>'admin/module/edit/'),
'id'=>array('label'=>'ID','url'=>URL::link('admin','module/edit/')),
'name'=>array('label'=>'Name'),
'status'=>array('label'=>'Active'),
),
@ -96,7 +96,7 @@ class Controller_Admin_Module extends Controller_TemplateDefault_Admin {
$mo->module_method->find_all(),
25,
array(
'id'=>array('label'=>'ID','url'=>'admin/module_method/edit/'),
'id'=>array('label'=>'ID','url'=>URL::link('admin','module_method/edit/')),
'name'=>array('label'=>'Name'),
'notes'=>array('label'=>'Notes'),
'menu_display'=>array('label'=>'Menu'),
@ -119,7 +119,7 @@ class Controller_Admin_Module extends Controller_TemplateDefault_Admin {
$methods,
25,
array(
'__VALUE__'=>array('label'=>'Name','url'=>sprintf('admin/module_method/add/%s/',$mo->id)),
'__VALUE__'=>array('label'=>'Name','url'=>URL::link('admin','module_method/add/'.$mo->id)),
),
array(
'page'=>TRUE,

View File

@ -40,7 +40,7 @@ class Controller_Admin_Module_Method extends Controller_Admin_Module {
'body'=>sprintf(_('Method %s defined to database'),$mmo->name),
));
HTTP::redirect(sprintf('admin/module/edit/%s',$mo->id));
HTTP::redirect(URL::link('admin','/module/edit/'.$mo->id));
} else {
SystemMessage::add(array(

View File

@ -19,7 +19,7 @@ class Controller_Admin_Setup extends Controller_TemplateDefault_Admin {
* View/Update the site configuration
*/
public function action_edit() {
$o = Config::instance()->so;
$o = Company::instance()->so();
$output = '';
if ($_POST) {
@ -58,7 +58,7 @@ class Controller_Admin_Setup extends Controller_TemplateDefault_Admin {
Script::add(array('type'=>'stdin','data'=>'
$(document).ready(function() {
$("div[id='.$mo->name.']").load("'.URL::site('admin/'.$mo->name.'/setup').'");
$("div[id='.$mo->name.']").load("'.URL::link('admin',$mo->name.'/setup',TRUE).'");
});'
));
}

View File

@ -32,7 +32,7 @@ class Controller_Admin_Welcome extends Controller_TemplateDefault_Admin {
'account->accnum()'=>array('label'=>'Num'),
'account->name()'=>array('label'=>'Account'),
'account->display("status")'=>array('label'=>'Active'),
'id'=>array('label'=>'ID','url'=>'user/invoice/view/'),
'id'=>array('label'=>'ID','url'=>URL::link('user','invoice/view/')),
'total(TRUE)'=>array('label'=>'Total','class'=>'right'),
'due(TRUE)'=>array('label'=>'Amount Due','class'=>'right'),
),
@ -51,7 +51,7 @@ class Controller_Admin_Welcome extends Controller_TemplateDefault_Admin {
'account->accnum()'=>array('label'=>'Num'),
'account->name()'=>array('label'=>'Account'),
'account->display("status")'=>array('label'=>'Active'),
'id'=>array('label'=>'ID','url'=>'user/invoice/view/'),
'id'=>array('label'=>'ID','url'=>URL::link('user','invoice/view/')),
'total(TRUE)'=>array('label'=>'Total','class'=>'right'),
'due(TRUE)'=>array('label'=>'Amount Due','class'=>'right'),
),
@ -70,7 +70,7 @@ class Controller_Admin_Welcome extends Controller_TemplateDefault_Admin {
'account->accnum()'=>array('label'=>'Num'),
'account->name()'=>array('label'),
'account->display("status")'=>array('label'=>'Active'),
'id'=>array('label'=>'ID','url'=>'user/invoice/view/'),
'id'=>array('label'=>'ID','url'=>URL::link('user','invoice/view/')),
'total(TRUE)'=>array('label'=>'Total','class'=>'right'),
'due(TRUE)'=>array('label'=>'Amount Due','class'=>'right'),
),
@ -90,7 +90,7 @@ class Controller_Admin_Welcome extends Controller_TemplateDefault_Admin {
'account->accnum()'=>array('label'=>'Num'),
'account->name()'=>array('label'=>'Account'),
'account->display("status")'=>array('label'=>'Active'),
'id'=>array('label'=>'ID','url'=>'admin/payment/view/'),
'id'=>array('label'=>'ID','url'=>URL::link('admin','payment/view/')),
'total_amt'=>array('label'=>'Total','class'=>'right'),
'balance(TRUE)'=>array('label'=>'Balance','class'=>'right'),
),

View File

@ -25,7 +25,7 @@ class Controller_Affiliate_Account extends Controller_TemplateDefault_Affiliate
$this->filter(ORM::factory('Account')->list_active(),$this->ao->affiliate->id,'sortkey(TRUE)'),
25,
array(
'id'=>array('label'=>'ID','url'=>'user/account/view/'),
'id'=>array('label'=>'ID','url'=>URL::link('user','account/view/')),
'accnum()'=>array('label'=>'Num'),
'name(TRUE)'=>array('label'=>'Account'),
'email'=>array('label'=>'Email'),
@ -35,7 +35,7 @@ class Controller_Affiliate_Account extends Controller_TemplateDefault_Affiliate
array(
'page'=>TRUE,
'type'=>'select',
'form'=>'user/account/view',
'form'=>URL::link('user','account/view'),
)),
));
}

View File

@ -14,7 +14,7 @@ class Controller_Debug extends Controller_TemplateDefault {
$output .= debug::vars(array(
'm'=>__METHOD__,
'site'=>Config::site(),
'siteID'=>Config::siteid(),
'siteID'=>Company::instance()->site(),
'siteMode'=>Config::sitemodeverbose(),
'modules'=>Config::appmodules(),
));

View File

@ -58,8 +58,8 @@ class Controller_Login extends lnApp_Controller_Login {
$et->to = array('account'=>array($mmto->account_id));
$et->variables = array(
'SITE'=>URL::base(TRUE,TRUE),
'SITE_ADMIN'=>Config::sitename(),
'SITE_NAME'=>Config::sitename(),
'SITE_ADMIN'=>Company::instance()->admin(),
'SITE_NAME'=>Company::instance()->name(),
'TOKEN'=>$mmto->token,
'TOKEN_EXPIRE_MIN'=>$token_expire,
'USER_NAME'=>sprintf('%s %s',$mmto->account->first_name,$mmto->account->last_name),
@ -72,7 +72,7 @@ class Controller_Login extends lnApp_Controller_Login {
// Redirect to our password reset, the Auth will validate the token.
} elseif (! empty($_REQUEST['token'])) {
HTTP::redirect(sprintf('user/account/resetpassword?token=%s',$_REQUEST['token']));
HTTP::redirect(URL::link('user','account/resetpassword?token=%s'.$_REQUEST['token']));
}
// Show our token screen even if the email was invalid.

View File

@ -21,7 +21,7 @@ class Controller_TemplateDefault extends lnApp_Controller_TemplateDefault {
protected function _headimages() {
// This is where we should be able to change our country
// @todo To implement
$co = Config::instance()->so->country;
$co = Config::country();
HeadImages::add(array(
'img'=>sprintf('img/country/%s.png',strtolower($co->two_code)),
'attrs'=>array('onclick'=>"target='_blank';",'title'=>$co->display('name'))
@ -43,7 +43,7 @@ class Controller_TemplateDefault extends lnApp_Controller_TemplateDefault {
}
private function _cart() {
return (! Config::moduleexist('cart') OR ! class_exists('Cart') OR ! count(Cart::instance()->contents()) OR strtolower(Request::current()->controller()) == 'cart') ? '' : Cart::instance()->cart_block();
return (! Config::module_exist('cart') OR ! class_exists('Cart') OR ! count(Cart::instance()->contents()) OR strtolower(Request::current()->controller()) == 'cart') ? '' : Cart::instance()->cart_block();
}
}
?>

View File

@ -15,11 +15,11 @@ class Controller_TemplateDefault_Admin extends Controller_TemplateDefault_User {
$module = Request::current()->controller();
if ($_POST AND isset($_POST['module_config'][$module]))
Config::instance()->so->module_config($module,$_POST['module_config'][$module])->save();
Config::instance()->module_config($module,$_POST['module_config'][$module])->save();
if ($config_items) {
$output = '';
$mc = Config::instance()->so->module_config($module);
$mc = Config::instance()->module_config($module);
$output .= Form::open();
$output .= View::factory('setup/admin/module/head');

View File

@ -62,9 +62,11 @@ class Controller_Tree extends lnApp_Controller_Tree {
foreach ($methods as $id => $mmo) {
if (preg_match('/_/',$mmo->name)) {
list($mode,$action) = explode('_',$mmo->name);
$url = URL::site(sprintf('%s/%s/%s',$mode,$mmo->module->name,$action));
$url = URL::link($mode,$mmo->module->name.'/'.$action,TRUE);
} else {
$url = URL::site(sprintf('%s/%s',$mmo->module->name,$mmo->name));
$url = URL::site($mmo->module->name.'/'.$mmo->name);
}
// We can split our menus into sub menus using the _ char.

View File

@ -11,11 +11,11 @@
*/
class Currency {
public static function display($amount) {
return Num::format($amount,Config::instance()->so->decimal_place,TRUE);
return Num::format($amount,Company::instance()->decimals(),TRUE);
}
public static function round($amount) {
return Num::round($amount,Config::instance()->so->decimal_place);
return Num::round($amount,Company::instance()->decimals());
}
}
?>

View File

@ -16,8 +16,8 @@ class DB extends Kohana_DB {
{
$db = new Database_Query_Builder_Delete($table);
if (! in_array($table,Config::$no_site_id_tables))
return $db->where($table.'.site_id','=',Config::siteid());
if (! in_array($table,ORM::$no_site_id_tables))
return $db->where($table.'.site_id','=',Company::instance()->site());
else
return $db;
}
@ -27,8 +27,8 @@ class DB extends Kohana_DB {
{
$db = new Database_Query_Builder_Update($table);
if (! in_array($table,Config::$no_site_id_tables))
return $db->where($table.'.site_id','=',Config::siteid());
if (! in_array($table,ORM::$no_site_id_tables))
return $db->where($table.'.site_id','=',Company::instance()->site());
else
return $db;
}

View File

@ -46,7 +46,7 @@ class Model_Account extends Model_Auth_UserDefault {
}
public function accnum() {
return sprintf('%s-%04s',Config::siteid(TRUE),$this->id);
return sprintf('%s-%04s',Company::instance()->site(TRUE),$this->id);
}
public function sortkey($withcompany=FALSE) {
@ -115,10 +115,6 @@ class Model_Account extends Model_Auth_UserDefault {
foreach ($this->invoices_due($date) as $io)
$result += $io->due();
// @todo This shouldnt really be required
if ($result < 0)
throw new Kohana_Exception($result);
return $format ? Currency::display($result) : $result;
}

View File

@ -25,7 +25,7 @@ class Model_Record_Id extends ORM_OSB {
$max = DB::select(array('MAX(id)','id'))
->from($mo->name)
->where('site_id','=',Config::siteid());
->where('site_id','=',Company::instance()->site());
$this->id = $max->execute()->get('id');
}

View File

@ -18,6 +18,7 @@ class Model_Setup extends ORM_OSB {
protected $_updated_column = FALSE;
protected $_has_one = array(
'account'=>array('foreign_key'=>'id','far_key'=>'admin_id'),
'country'=>array('foreign_key'=>'id','far_key'=>'country_id'),
'language'=>array('foreign_key'=>'id','far_key'=>'language_id'),
);

View File

@ -64,7 +64,7 @@ abstract class ORM extends Kohana_ORM {
return (int) DB::select(array(DB::expr('COUNT(*)'), 'records_found'))
->from($this->_has_many[$alias]['through'])
->where($this->_has_many[$alias]['foreign_key'], '=', $this->pk())
->where('site_id', '=', Config::siteid())
->where('site_id', '=', Company::instance()->site())
->execute($this->_db)->get('records_found');
}
@ -81,14 +81,17 @@ abstract class ORM extends Kohana_ORM {
->from($this->_has_many[$alias]['through'])
->where($this->_has_many[$alias]['foreign_key'], '=', $this->pk())
->where($this->_has_many[$alias]['far_key'], 'IN', $far_keys)
->where('site_id', '=', Config::siteid())
->where('site_id', '=', Company::instance()->site())
->execute($this->_db)->get('records_found');
// Rows found need to match the rows searched
return (int) $count;
}
/** OSB SPECIFIC ENHANCEMENTS **
/** OSB SPECIFIC ENHANCEMENTS **/
// Tables that do not have a site_id column
public static $no_site_id_tables = array('setup','country','currency','language','tax');
/**
* Add our OSB site_id to each SELECT query
@ -96,8 +99,8 @@ abstract class ORM extends Kohana_ORM {
*/
final protected function _build($type) {
// Exclude tables without site ID's
if (! in_array($this->_table_name,Config::$no_site_id_tables))
$this->where($this->_object_name.'.site_id','=',Config::siteid());
if (! in_array($this->_table_name,ORM::$no_site_id_tables))
$this->where($this->_object_name.'.site_id','=',Company::instance()->site());
return parent::_build($type);
}

View File

@ -135,7 +135,7 @@ abstract class ORM_OSB extends ORM {
}
public function config($key) {
$mc = Config::instance()->so->module_config($this->_object_name);
$mc = Config::instance()->module_config($this->_object_name);
return empty($mc[$key]) ? '' : $mc[$key];
}
@ -172,7 +172,7 @@ abstract class ORM_OSB extends ORM {
return TRUE;
$model->_changed[$field] = $field;
$model->$field = Config::siteid();
$model->$field = Company::instance()->site();
return TRUE;
}

View File

@ -0,0 +1,31 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* Request. Uses the [Route] class to determine what
* [Controller] to send the request to.
*
* @package lnApp/Modifications
* @category Classes
* @author Deon George
* @copyright (c) 2010 Deon George
* @license http://dev.leenooks.net/license.html
*/
class Request extends Kohana_Request {
/**
* Sets and gets the directory for the controller.
*
* We override the Kohana version, so that we can have short directory URLs.
* eg: admin=>a,reseller=>r.
*
* @param string $directory Directory to execute the controller from
* @return mixed
*/
public function directory($directory = NULL) {
// If $directory is NULL, we are a getter and see if we need to expand the directory
if ($directory === NULL AND $this->_directory)
$this->_directory = URL::dir($this->_directory);
return parent::directory($directory);
}
}
?>

View File

@ -0,0 +1,54 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class overrides Kohana's URL
*
* @package OSB/Modifications
* @category Classes
* @category Helpers
* @author Deon George
* @copyright (c) 2010 Deon George
* @license http://dev.leenooks.net/license.html
*/
class URL extends Kohana_URL {
// Our method paths for different functions
public static $method_directory = array(
'admin'=>'a',
'affiliate'=>'affiliate', // @todo To retire
'reseller'=>'r',
'user'=>'u',
);
/**
* Wrapper to provide a URL::site() link based on function
*/
public static function link($dir,$src,$site=FALSE) {
if (! $dir)
return $src;
if (! array_key_exists($dir,URL::$method_directory))
throw new Kohana_Exception('Unknown directory :dir for :src',array(':dir'=>$dir,':src'=>$src));
$x = URL::$method_directory[$dir].'/'.$src;
return $site ? URL::site($x) : $x;
}
/**
* Function to reveal the real directory for a URL
*/
public static function dir($dir) {
// Quick check if we can do something here
if (! in_array(strtolower($dir),URL::$method_directory))
return $dir;
// OK, we can, find it.
foreach (URL::$method_directory as $k=>$v)
if (strtolower($dir) == $v)
return ucfirst($k);
// If we get here, we didnt have anything.
return $dir;
}
}
?>

View File

@ -12,32 +12,18 @@
*/
return array(
'appname' => '',
'appname' => 'OS Billing',
'cache_type' => 'file',
'email_from' => array('noreply@graytech.net.au'=>'Graytech Hosting'),
'email_admin_only'=> array(
// 'adsl_traffic_notice'=>array('deon@leenooks.vpn'=>'Deon George'),
),
'method_directory'=> array( // Out method paths for the different functions
'admin',
'affiliate',
'reseller',
'task',
'user',
),
'method_security' => TRUE, // Enables Method Security. Setting to false means any method can be run without authentication
'session_change_trigger'=>array( // Updates to tables to make when our session ID is changed
'Cart'=>'session_id',
),
'site' => array(
'172.31.9.4'=>1,
'www.graytech.net.au'=>1,
),
'site_debug' => FALSE,
'bsb' => '633-000', // @todo This should come from the DB
'accnum' => '120 440 821', // @todo This should come from the DB
'site_name' => 'Graytech Hosting Pty Ltd', // @todo This should come from the DB
'taxid' => 'ABN: 49 106 229 476', // @todo This should come from the DB
'theme' => 'yaml', // @todo This should be in the DB
'tmpdir' => '/tmp',
);

View File

@ -17,6 +17,7 @@ return array
'etag'=>FALSE, // Force generating ETAGS
'checkout_notify'=>FALSE, // Test mode to test a particular checkout_notify item
'invoice'=>0, // Number of invoices to generate in a pass
'site'=>FALSE, // Glogal site debug
'show_inactive'=>FALSE, // Show Inactive Items
'task_sim'=>FALSE, // Simulate running tasks
);

View File

@ -1,6 +1,6 @@
<tr>
<td>
<a href="<?php echo URL::site(sprintf('admin/group/edit/%s',$group->id)); ?>"><?php echo $group->display('name'); ?></a>
<a href="<?php echo URL::link('admin','group/edit/'.$group->id,TRUE); ?>"><?php echo $group->display('name'); ?></a>
</td>
<td><?php echo $group->display('notes'); ?></td>
<td><?php echo $group->display('status'); ?></td>

View File

@ -26,8 +26,8 @@
<div id="page">
<div id="topnav">
<div class="langMenu">
<?php echo Country::icon(Config::instance()->so->country_id); ?>
<span class="text"><?php echo Config::instance()->so->country->display('name'); ?></span>
<?php echo Country::icon(Config::country()); ?>
<span class="text"><?php echo Config::country()->display('name'); ?></span>
<!-- //@todo Enable contact form -->
<div style="display:none">
<span class="text2"> &#124; </span>
@ -36,7 +36,7 @@
<span class="text2"> &#124; </span>
<?php echo Config::login_uri(); ?>
</div>
<span><?php echo Company::name(); ?></span>
<span><?php echo Company::instance()->name(); ?></span>
</div>
<div id="header">
<h1><span>&nbsp;</span>&nbsp;</h1>

View File

@ -27,7 +27,7 @@ class Controller_Admin_Charge extends Controller_TemplateDefault_Admin {
ORM::factory('Charge')->where('sweep_type','>=',0)->order_by('date_orig DESC')->find_all(),
25,
array(
'id'=>array('label'=>'ID','url'=>'user/charge/view/'),
'id'=>array('label'=>'ID','url'=>URL::site('user','charge/view/')),
'date_orig'=>array('label'=>'Date'),
'sweep_type'=>array('label'=>'Sweep'),
'status'=>array('label'=>'Status'),
@ -42,7 +42,7 @@ class Controller_Admin_Charge extends Controller_TemplateDefault_Admin {
array(
'page'=>TRUE,
'type'=>'select',
'form'=>'user/charge/view',
'form'=>URL::site('user','charge/view'),
)),
));
}
@ -91,7 +91,7 @@ class Controller_Admin_Charge extends Controller_TemplateDefault_Admin {
Script::add(array('type'=>'stdin','data'=>'
$(document).ready(function() {
$("input[name=account_id]").autocomplete({
source: "'.URL::site('admin/account/ajaxlist').'",
source: "'.URL::site('a/account/ajaxlist').'",
minLength: 2,
change: function(event,ui) {
// Send the request and update sub category dropdown
@ -100,7 +100,7 @@ class Controller_Admin_Charge extends Controller_TemplateDefault_Admin {
data: "aid="+$(this).val(),
dataType: "json",
cache: false,
url: "'.URL::site('admin/service/ajaxlist').'",
url: "'.URL::link('admin','service/ajaxlist',TRUE).'",
timeout: 2000,
error: function() {
alert("Failed to submit");

View File

@ -28,7 +28,7 @@ class Controller_Admin_Email extends Controller_TemplateDefault_Admin {
ORM::factory('Email_Log')->find_all(),
25,
array(
'id'=>array('label'=>'ID','url'=>'user/email/view/'),
'id'=>array('label'=>'ID','url'=>URL::link('user','email/view/')),
'date_orig'=>array('label'=>'Date'),
'email'=>array('label'=>'To'),
'translate_resolve("subject")'=>array('label'=>'Subject'),
@ -38,7 +38,7 @@ class Controller_Admin_Email extends Controller_TemplateDefault_Admin {
array(
'page'=>TRUE,
'type'=>'select',
'form'=>'user/email/view',
'form'=>URL::link('user','email/view'),
)),
));
}
@ -108,7 +108,7 @@ class Controller_Admin_Email extends Controller_TemplateDefault_Admin {
$eto = ORM::factory('Email_Template',$id);
if (! $eto->loaded())
HTTP::redirect('email/admin/template/list');
HTTP::redirect(URL::link('admin','email/template/list'));
$output = '';

View File

@ -26,14 +26,14 @@ class Controller_User_Email extends Controller_TemplateDefault_User {
$this->ao->email_log->find_all(),
25,
array(
'id'=>array('label'=>'ID','url'=>'user/email/view/'),
'id'=>array('label'=>'ID','url'=>URL::link('user','email/view/')),
'date_orig'=>array('label'=>'Date'),
'translate_resolve("subject")'=>array('label'=>'Subject'),
),
array(
'page'=>TRUE,
'type'=>'select',
'form'=>'user/email/view',
'form'=>URL::link('user','email/view'),
)),
));
}

View File

@ -132,7 +132,7 @@ class Email_Template {
throw new Kohana_Exception('Component :component has not been configured in :method',array(':component'=>$component,':method'=>__METHOD__));
}
} else {
$sm->setSubject(_('Email from').' '.Company::name());
$sm->setSubject(_('Email from').' '.Company::instance()->name());
$sm->setBody(print_r($this->email_data['variables'],TRUE),'text/plain');
}
}

View File

@ -1,4 +1,4 @@
<tr>
<td><a href="<?php echo URL::site('admin/email/templateedit/'.$template->id); ?>" alt=""><?php echo $template->name; ?></a></td>
<td><a href="<?php echo URL::link('admin','email/templateedit/'.$template->id,TRUE); ?>" alt=""><?php echo $template->name; ?></a></td>
<td><?php echo $template->display('status'); ?></td>
</tr>

View File

@ -40,9 +40,9 @@ class Export_Quicken extends Export {
// @todo - should be configurable
$qio->TERMS = '7 Days';
// @todo - should be configurable
$qio->INVTITLE = Company::name().' Invoice';
$qio->INVTITLE = Company::instance()->name().' Invoice';
// @todo - should be configurable
$qio->INVMEMO = 'Thank you for using '.Company::name();
$qio->INVMEMO = 'Thank you for using '.Company::instance()->name();
$qio->DOCNUM = sprintf('%06s',$pio->invoice->id);
$qio->DUEDATE = date('m/d/Y',$pio->invoice->due_date);
$qio->AMOUNT = sprintf('%3.2f',$pio->invoice->total());

View File

@ -41,13 +41,13 @@ class Controller_Admin_Host extends Controller_TemplateDefault_Admin {
ORM::factory('Host_Server')->find_all(),
25,
array(
'id'=>array('label'=>'ID','url'=>'admin/host/update/'),
'id'=>array('label'=>'ID','url'=>URL::link('admin','host/update/')),
'name'=>array('label'=>'Details'),
),
array(
'page'=>TRUE,
'type'=>'select',
'form'=>'admin/host/update/',
'form'=>URL::link('admin','host/update'),
)),
));
}

View File

@ -56,7 +56,7 @@ class Model_Host_Server extends ORM_OSB {
$("button[name=submit]").click(function() {
var t=$(this).val().split(":");
if (x++) { alert("Session expired, please refresh the page!"); return false; }
$.getJSON("'.URL::site('admin/host/ajaxmanage/'.$this->id).'", { k: "'.$k.'",t: t[1] }, function(data) {
$.getJSON("'.URL::link('admin','host/ajaxmanage/'.$this->id,TRUE).'", { k: "'.$k.'",t: t[1] }, function(data) {
$.each(data, function(key, val) { $("#"+key+"_"+t[0]+"_"+t[1]).val(val); });
})
.error(function() { alert("There was a problem with the request"); return false; })

View File

@ -46,7 +46,7 @@ class Controller_Admin_Invoice extends Controller_TemplateDefault_Admin {
ORM::factory('Invoice')->find_all(),
25,
array(
'id'=>array('label'=>'ID','url'=>'user/invoice/view/'),
'id'=>array('label'=>'ID','url'=>URL::link('user','invoice/view/')),
'date_orig'=>array('label'=>'Date'),
'total(TRUE)'=>array('label'=>'Total','class'=>'right'),
'credit_amt'=>array('label'=>'Credits','class'=>'right'),
@ -58,7 +58,7 @@ class Controller_Admin_Invoice extends Controller_TemplateDefault_Admin {
array(
'page'=>TRUE,
'type'=>'select',
'form'=>'user/invoice/view',
'form'=>URL::link('user','invoice/view'),
)),
));
}

View File

@ -76,8 +76,8 @@ class Controller_Task_Invoice extends Controller_Task {
'DUE_DATE'=>$io->display('due_date'),
'FIRST_NAME'=>$io->account->first_name,
'INV_NUM'=>$io->refnum(),
'INV_URL'=>URL::site('user/invoice/view/'.$io->id,'http'),
'SITE_NAME'=>Company::name(),
'INV_URL'=>URL::site(URL::link('user','invoice/view/'.$io->id),'http'),
'SITE_NAME'=>Company::instance()->name(),
);
// @todo Record email log id if possible.
@ -131,10 +131,10 @@ class Controller_Task_Invoice extends Controller_Task {
'EMAIL'=>Company::email(),
'FIRST_NAME'=>$io->account->first_name,
'INV_NUM'=>$io->refnum(),
'INV_URL'=>URL::site('user/invoice/view/'.$io->id,'http'),
'INV_URL'=>URL::site(URL::link('user','invoice/view/'.$io->id),'http'),
'LATE_FEE'=>'5.50', // @todo This should come from a config file.
'PAYMENTS_TABLE'=>$io->account->payment->list_recent_table(),
'SITE_NAME'=>Company::name(),
'SITE_NAME'=>Company::instance()->name(),
);
// @todo Record email log id if possible.
@ -303,9 +303,9 @@ class Controller_Task_Invoice extends Controller_Task {
'FIRST_NAME'=>$io->account->first_name,
'HTML_INVOICE'=>$io->html(),
'INV_NUM'=>$io->refnum(),
'INV_URL'=>URL::site('user/invoice/view/'.$io->id,'http'),
'INV_URL_DOWNLOAD'=>URL::site(sprintf('user/invoice/download/%s?token=%s',$io->id,$token),'http'),
'SITE_NAME'=>Company::name(),
'INV_URL'=>URL::site(URL::link('user','invoice/view/'.$io->id),'http'),
'INV_URL_DOWNLOAD'=>URL::site(URL::link('user',sprintf('invoice/download/%s?token=%s',$io->id,$token)),'http'),
'SITE_NAME'=>Company::instance()->name(),
);
// @todo Record email log id if possible.

View File

@ -27,7 +27,7 @@ class Controller_User_Invoice extends Controller_TemplateDefault_User {
$this->ao->invoice->find_all(),
25,
array(
'id'=>array('label'=>'ID','url'=>'user/invoice/view/'),
'id'=>array('label'=>'ID','url'=>URL::link('user','invoice/view/')),
'date_orig'=>array('label'=>'Date Issued'),
'due_date'=>array('label'=>'Date Due'),
'total(TRUE)'=>array('label'=>'Total','class'=>'right'),
@ -38,7 +38,7 @@ class Controller_User_Invoice extends Controller_TemplateDefault_User {
array(
'page'=>TRUE,
'type'=>'select',
'form'=>'user/invoice/view',
'form'=>URL::link('user','invoice/view'),
)),
));
}
@ -51,7 +51,7 @@ class Controller_User_Invoice extends Controller_TemplateDefault_User {
$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()))) {
if (! $io->loaded() AND ! in_array($this->ao->affiliate->id,$io->service_affiliates())) {
$this->template->content = 'Unauthorised or doesnt exist?';
return FALSE;

View File

@ -22,6 +22,8 @@ require_once('includes/tcpdf/tcpdf.php');
abstract class Invoice_TCPDF extends TCPDF {
// Our invoice object
protected $io;
// Our company object
protected $co;
protected $billToCompany = true;
protected $itemsSummaryMax = 16;
@ -48,11 +50,12 @@ abstract class Invoice_TCPDF extends TCPDF {
parent::__construct();
$this->io = $io;
$this->co = Company::instance();
// Set up the invoice
$this->SetCreator('Open Source Billing');
$this->SetAuthor(Company::name());
$this->SetTitle(sprintf('%s Invoice',Company::name()));
$this->SetAuthor($this->co->name());
$this->SetTitle(sprintf('%s Invoice',$this->co->name()));
$this->SetSubject(sprintf('Invoice #%06s',$this->io->id()));
$this->SetKeywords($this->io->id());
$this->SetAutoPageBreak(TRUE,25);

View File

@ -23,7 +23,7 @@ class Invoice_TCPDF_Default extends Invoice_TCPDF {
public function drawCompanyLogo() {
$x = 9; $y = 7;
$size = 25;
$logo = Config::logo_file();
$logo = $this->co->logo_file();
if (is_file($logo))
$this->Image($logo,$x,$y,$size);
@ -37,17 +37,17 @@ class Invoice_TCPDF_Default extends Invoice_TCPDF {
$x = 40; $y = 7;
$this->SetFont('helvetica','B',10);
$this->SetXY($x,$y); $this->Cell(0,0,Company::name()); $y += 4;
$this->SetXY($x,$y); $this->Cell(0,0,$this->co->name()); $y += 4;
$this->SetFont('helvetica','',10);
$this->SetXY($x,$y); $this->Cell(0,0,Company::taxid()); $y += 6;
$this->SetXY($x,$y); $this->Cell(0,0,$this->co->taxid()); $y += 6;
$this->SetXY($x,$y); $this->Cell(0,0,Company::street(', ')); $y += 4;
$this->SetXY($x,$y); $this->Cell(0,0,sprintf('%s, %s %s',Company::city(),Company::state(),Company::pcode())); $y += 4;
$this->SetXY($x,$y); $this->Cell(0,0,$this->co->street(', ')); $y += 4;
$this->SetXY($x,$y); $this->Cell(0,0,sprintf('%s, %s %s',$this->co->city(),$this->co->state(),$this->co->pcode())); $y += 4;
$y += 2;
$this->SetXY($x,$y); $this->Cell(0,0,'Phone:'); $this->SetXY($x+16,$y); $this->Cell(0,0,Company::phone()); $y += 4;
$this->SetXY($x,$y); $this->Cell(0,0,'Fax:'); $this->SetXY($x+16,$y); $this->Cell(0,0,Company::fax()); $y += 4;
$this->SetXY($x,$y); $this->Cell(0,0,'Phone:'); $this->SetXY($x+16,$y); $this->Cell(0,0,$this->co->phone()); $y += 4;
$this->SetXY($x,$y); $this->Cell(0,0,'Fax:'); $this->SetXY($x+16,$y); $this->Cell(0,0,$this->co->fax()); $y += 4;
$this->SetXY($x,$y); $this->Cell(0,0,'Web:'); $this->SetXY($x+16,$y); $this->addHtmlLink(URL::base(TRUE,TRUE),URL::base(TRUE,TRUE)); $y += 4;
}
@ -65,7 +65,7 @@ class Invoice_TCPDF_Default extends Invoice_TCPDF {
$this->SetFont('helvetica','',8);
$this->SetXY($x,$y); $this->Cell(0,0,_('Please return this portion with your cheque or money order')); $y +=3;
$this->SetXY($x,$y); $this->Cell(0,0,_('made payable to').' '.Company::name());
$this->SetXY($x,$y); $this->Cell(0,0,_('made payable to').' '.$this->co->name());
// Due Date
$x = 110; $y = 200;
@ -91,9 +91,9 @@ class Invoice_TCPDF_Default extends Invoice_TCPDF {
// Company Address
$y = 216;
$this->SetFont('helvetica','',10);
$this->SetXY(18,$y); $this->Cell(0,0,Company::name()); $y += 4;
$this->SetXY(18,$y); $this->Cell(0,0,Company::street(', ')); $y += 4;
$this->SetXY(18,$y); $this->Cell(0,0,sprintf('%s, %s %s',Company::city(),Company::state(),Company::pcode())); $y += 4;
$this->SetXY(18,$y); $this->Cell(0,0,$this->co->name()); $y += 4;
$this->SetXY(18,$y); $this->Cell(0,0,$this->co->street(', ')); $y += 4;
$this->SetXY(18,$y); $this->Cell(0,0,sprintf('%s, %s %s',$this->co->city(),$this->co->state(),$this->co->pcode())); $y += 4;
// Previous Due
$y = 215;

View File

@ -4,8 +4,8 @@
<td style="vertical-align: top">
<table class="company_details" border="0">
<tr>
<td class="logo"><?php echo Config::logo(); ?></td>
<td class="address"><span class="company_name"><?php echo Company::name(); ?></span><br/><?php echo Company::address(); ?><br/><?php echo Company::contacts(); ?></td>
<td class="logo"><?php echo Company::instance()->logo(); ?></td>
<td class="address"><span class="company_name"><?php echo Company::instance()->name(); ?></span><br/><?php echo Company::instance()->address(); ?><br/><?php echo Company::instance()->contacts(); ?></td>
</tr>
</table>
</td>

View File

@ -4,14 +4,14 @@
<td style="vertical-align: top">
<table class="company_details" border="0">
<tr>
<td class="logo"><?php echo Config::logo(); ?></td>
<td class="logo"><?php echo Company::instance()->logo(); ?></td>
<td class="address">
<span class="company_name"><?php echo Company::name(); ?></span><br/>
<?php echo Company::taxid(); ?><br/>
<span class="company_name"><?php echo Company::instance()->name(); ?></span><br/>
<?php echo Company::instance()->taxid(); ?><br/>
<br/>
<?php echo Company::address(); ?><br/>
<?php echo Company::instance()->address(); ?><br/>
<br/>
<?php echo Company::contacts(); ?>
<?php echo Company::instance()->contacts(); ?>
</td>
</tr>
</table>
@ -85,7 +85,7 @@
$lp = $ito->product_id; ?>
<!-- Service Information -->
<tr class="head">
<td><?php echo HTML::anchor('/user/service/view/'.$ito->service_id,$ito->service->id()); ?></td>
<td><?php echo HTML::anchor(URL::link('user','service/view/'.$ito->service_id),$ito->service->id()); ?></td>
<td colspan="5"><?php printf('%s - %s',$ito->product->name(),$ito->service->name()); ?> (<?php echo $ito->product_id; ?>)</td>
<td class="right"><?php echo ($i++==0 ? Currency::display($io->items_service_total($ito->service_id)) : '&nbsp;');?></td>
</tr>
@ -213,6 +213,6 @@
</td>
</tr>
<tr>
<td><?php echo HTML::anchor('user/invoice/download/'.$io->id,'Download detailed invoice'); ?></td>
<td><?php echo HTML::anchor(URL::link('user','invoice/download/'.$io->id),'Download detailed invoice'); ?></td>
</tr>
</table>

View File

@ -18,7 +18,7 @@ class lnApp_Controller_Login extends Controller_TemplateDefault {
// If user already signed-in
if (Auth::instance()->logged_in()!= 0) {
// Redirect to the user account
HTTP::redirect('user/welcome/index');
HTTP::redirect(URL::link('user','welcome/index'));
}
// If there is a post and $_POST is not empty
@ -35,7 +35,7 @@ class lnApp_Controller_Login extends Controller_TemplateDefault {
HTTP::redirect($redir);
} else
HTTP::redirect('user/welcome/index');
HTTP::redirect(URL::link('user','welcome/index'));
} else {
// We are not successful logging in, so delete our session data

View File

@ -166,7 +166,7 @@ abstract class lnApp_Controller_TemplateDefault extends Controller_Template {
$this->template->title = '';
// Language
$this->meta->language = Config::instance()->so->language->iso;
$this->meta->language = Config::language();
// Description
$this->meta->description = sprintf('%s::%s',$this->request->controller(),$this->request->action());
@ -243,7 +243,7 @@ abstract class lnApp_Controller_TemplateDefault extends Controller_Template {
}
public function _footer() {
return sprintf('&copy; %s',Config::SiteName());
return sprintf('&copy; %s',Config::sitename());
}
/**

View File

@ -108,7 +108,7 @@ $(function () {
'attr'=>array('id'=>sprintf('B_%s',$branch['id'])),
'state'=>$branch['state'],
'data'=>array('title'=>$branch['name']),
'attr'=>array('id'=>sprintf('N_%s',$branch['id']),'href'=>empty($branch['attr_href']) ? URL::site(sprintf('user/%s/menu',$branch['name'])) : $branch['attr_href']),
'attr'=>array('id'=>sprintf('N_%s',$branch['id']),'href'=>empty($branch['attr_href']) ? URL::link('user',$branch['name'].'/menu',TRUE) : $branch['attr_href']),
)
);
}

View File

@ -79,7 +79,7 @@ class Controller_Admin_Payment extends Controller_TemplateDefault_Admin {
ORM::factory('Payment')->find_all(),
25,
array(
'id'=>array('label'=>'ID','url'=>'admin/payment/view/'),
'id'=>array('label'=>'ID','url'=>URL::link('admin','payment/view/')),
'date_payment'=>array('label'=>'Date'),
'account->accnum()'=>array('class'=>'right'),
'account->name()'=>array('label'=>'Account'),
@ -91,7 +91,7 @@ class Controller_Admin_Payment extends Controller_TemplateDefault_Admin {
array(
'page'=>TRUE,
'type'=>'select',
'form'=>'admin/payment/view',
'form'=>URL::link('admin','payment/view'),
)),
));
}
@ -151,7 +151,7 @@ class Controller_Admin_Payment extends Controller_TemplateDefault_Admin {
}
});
$("input[name=account_id]").autocomplete({
source: "'.URL::site('admin/payment/ajaxlist').'",
source: "'.URL::link('admin','payment/ajaxlist',TRUE).'",
minLength: 2,
change: function(event,ui) {
// Send the request and update sub category dropdown
@ -160,7 +160,7 @@ class Controller_Admin_Payment extends Controller_TemplateDefault_Admin {
data: "key="+$(this).val(),
dataType: "html",
cache: false,
url: "'.URL::site('admin/payment/autoitemlist').'",
url: "'.URL::link('admin','payment/autoitemlist',TRUE).'",
timeout: 2000,
error: function(x) {
alert("Failed to submit");
@ -177,7 +177,7 @@ class Controller_Admin_Payment extends Controller_TemplateDefault_Admin {
if ($po->loaded()) {
Script::add(array('type'=>'stdin','data'=>'
$(document).ready(function() {
$("div[id=items]").load("'.URL::site('admin/payment/autoitemlist').'", {key: "'.$po->account_id.'", pid: "'.$po->id.'" });
$("div[id=items]").load("'.URL::link('admin','payment/autoitemlist',TRUE).'", {key: "'.$po->account_id.'", pid: "'.$po->id.'" });
});'
));
}

View File

@ -41,8 +41,8 @@ class Payment_Bulk_Ezypay {
$array = explode("\t",$line);
// Field 4 has our account reference
if (preg_match('/^'.Config::siteid(TRUE).'-/',$array[4]) AND $array[10] == 'Cleared') {
$aid = preg_replace('/^'.Config::siteid(TRUE).'-/','',$array[4]);
if (preg_match('/^'.Company::instance()->site(TRUE).'-/',$array[4]) AND $array[10] == 'Cleared') {
$aid = preg_replace('/^'.Compan::instance()->site(TRUE).'-/','',$array[4]);
$po = ORM::factory('Payment');
$po->account_id = $aid;

View File

@ -1,5 +1,5 @@
<tr>
<td><?php echo HTML::anchor('admin/payment/view/'.$o->id,$o->display('id')); ?></td>
<td><?php echo HTML::anchor(URL::link('admin','payment/view/'.$o->id),$o->display('id')); ?></td>
<td><?php echo $o->display('date_payment'); ?></td>
<td><?php echo $o->display('total_amt'); ?></td>
<td><?php echo $o->display('fees_amt'); ?></td>

View File

@ -1,5 +1,5 @@
<tr class="<?php echo $trc; ?>">
<td><?php echo HTML::anchor('user/invoice/view/'.$io->id,$io->id()); ?></td>
<td><?php echo HTML::anchor(URL::link('user','invoice/view/'.$io->id),$io->id()); ?></td>
<td><?php echo $io->display('date_orig'); ?></td>
<td><?php echo $io->display('due_date'); ?></td>
<td><?php echo $io->total(TRUE); ?></td>

View File

@ -49,7 +49,7 @@ class Controller_Admin_Product extends Controller_TemplateDefault_Admin {
$prods,
25,
array(
'id'=>array('label'=>'ID','url'=>'admin/product/view/'),
'id'=>array('label'=>'ID','url'=>URL::link('admin','product/view/')),
'name()'=>array('label'=>'Details'),
'status'=>array('label'=>'Active'),
'prod_plugin_file'=>array('label'=>'Plugin Name'),
@ -62,7 +62,7 @@ class Controller_Admin_Product extends Controller_TemplateDefault_Admin {
array(
'page'=>TRUE,
'type'=>'select',
'form'=>'admin/product/view',
'form'=>URL::link('admin','product/view'),
)),
));
}
@ -102,7 +102,7 @@ class Controller_Admin_Product extends Controller_TemplateDefault_Admin {
data: "key="+$(this).val(),
dataType: "html",
cache: false,
url: "'.URL::site('admin/product/ajaxtranslateform/'.$po->id).'",
url: "'.URL::link('admin','product/ajaxtranslateform/'.$po->id,TRUE).'",
timeout: 2000,
error: function(x) {
alert("Failed to submit");
@ -125,7 +125,7 @@ class Controller_Admin_Product extends Controller_TemplateDefault_Admin {
ORM::factory('Service')->where('product_id','=',$po->id)->find_all(),
25,
array(
'id'=>array('label'=>'ID','url'=>'user/service/view/'),
'id'=>array('label'=>'ID','url'=>URL::link('user','service/view/')),
'account->accnum()'=>array(),
'account->name()'=>array('label'=>'Account'),
'name()'=>array('label'=>'Details'),
@ -135,7 +135,7 @@ class Controller_Admin_Product extends Controller_TemplateDefault_Admin {
array(
'page'=>TRUE,
'type'=>'select',
'form'=>'user/service/view',
'form'=>URL::link('user','service/view'),
)),
));
}

View File

@ -25,9 +25,9 @@ class Model_Product_Category extends ORM_OSB {
// If the user is not logged in, show the site default language
// @todo This needs to change to the session language.
if (! $ao=Auth::instance()->get_user())
$ao=Config::instance()->so;
$ao=Company::instance()->so();
return ($a=$this->product_category_translate->where('language_id','=',$ao->language_id)->find()->description) ? $a : _('No Description');
return ($x=$this->product_category_translate->where('language_id','=',$ao->language_id)->find()->description) ? $x : _('No Description');
}
/**

View File

@ -74,7 +74,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
ORM::factory('Service')->find_all(),
25,
array(
'id'=>array('label'=>'ID','url'=>'user/service/view/'),
'id'=>array('label'=>'ID','url'=>URL::link('user','service/view/')),
'service_name()'=>array('label'=>'Details'),
'recur_schedule'=>array('label'=>'Billing'),
'price(TRUE,TRUE)'=>array('label'=>'Price','class'=>'right'),
@ -85,7 +85,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
array(
'page'=>TRUE,
'type'=>'select',
'form'=>'user/service/view',
'form'=>URL::link('user','service/view'),
)),
));
}
@ -111,7 +111,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
$svs,
25,
array(
'id'=>array('label'=>'ID','url'=>'user/service/view/'),
'id'=>array('label'=>'ID','url'=>URL::link('user','service/view/')),
'service_name()'=>array('label'=>'Details'),
'recur_schedule'=>array('label'=>'Billing'),
'price(TRUE,TRUE)'=>array('label'=>'Price','class'=>'right'),
@ -124,7 +124,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
array(
'page'=>TRUE,
'type'=>'select',
'form'=>'user/service/view',
'form'=>URL::link('user','service/view'),
)),
));
@ -143,7 +143,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
$svs,
25,
array(
'id'=>array('label'=>'ID','url'=>'user/service/view/'),
'id'=>array('label'=>'ID','url'=>URL::link('user','service/view/')),
'service_name()'=>array('label'=>'Details'),
'recur_schedule'=>array('label'=>'Billing'),
'price(TRUE,TRUE)'=>array('label'=>'Price','class'=>'right'),
@ -156,7 +156,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
array(
'page'=>TRUE,
'type'=>'select',
'form'=>'user/service/view',
'form'=>URL::link('user','service/view'),
)),
));
}
@ -198,7 +198,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
$svs = ORM::factory('Service')->list_bylistgroup('ADSL');
$google = GoogleChart::factory('ComboChart')
->dataurl(URL::site('admin/service/ajaxjson_traffic'))
->dataurl(URL::link('admin','service/ajaxjson_traffic',TRUE))
->title(sprintf('ADSL traffic as at %s',date('Y-m-d',strtotime('yesterday'))));
Block::add(array('body'=>(string)$google));
@ -209,7 +209,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
$svs,
NULL,
array(
'id'=>array('label'=>'ID','url'=>'user/service/view/'),
'id'=>array('label'=>'ID','url'=>URL::link('user','service/view/')),
'name()'=>array('label'=>'Service'),
'plugin()->ipaddress()'=>array('label'=>'IP Address'),
'product->plugin()->speed'=>array('label'=>'Speed'),
@ -225,7 +225,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
),
array(
'type'=>'select',
'form'=>'user/service/view',
'form'=>URL::link('user','service/view'),
)),
));
}
@ -244,14 +244,14 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
$svs,
NULL,
array(
'id'=>array('label'=>'ID','url'=>'user/service/view/'),
'id'=>array('label'=>'ID','url'=>URL::link('user','service/view/')),
'service_name()'=>array('label'=>'Service'),
'expire(TRUE)'=>array('label'=>'Expires'),
'due(TRUE)'=>array('label'=>'Due'),
),
array(
'type'=>'select',
'form'=>'user/service/view',
'form'=>URL::link('user','service/view'),
)),
));
}
@ -277,7 +277,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
$svs,
NULL,
array(
'id'=>array('label'=>'ID','url'=>'user/service/view/'),
'id'=>array('label'=>'ID','url'=>URL::link('user','service/view/')),
'name()'=>array('label'=>'Service'),
'plugin()->ipaddress()'=>array('label'=>'IP Address'),
'product->plugin()->speed'=>array('label'=>'Speed'),
@ -292,7 +292,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
),
array(
'type'=>'select',
'form'=>'user/service/view',
'form'=>URL::link('user','service/view'),
)),
));
}
@ -307,7 +307,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
$svs,
25,
array(
'id'=>array('label'=>'ID','url'=>'user/service/view/'),
'id'=>array('label'=>'ID','url'=>URL::link('user','service/view/')),
'service_name()'=>array('label'=>'Details'),
'plugin()->display("domain_expire")'=>array('label'=>'Expire'),
'recur_schedule'=>array('label'=>'Billing'),
@ -319,7 +319,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
array(
'page'=>TRUE,
'type'=>'select',
'form'=>'user/service/view',
'form'=>URL::link('user','service/view'),
)),
));
}
@ -340,7 +340,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
$list[$sid],
25,
array(
'id'=>array('label'=>'ID','url'=>'user/service/view/'),
'id'=>array('label'=>'ID','url'=>URL::link('user','service/view/')),
'service_name()'=>array('label'=>'Details'),
'plugin()->display("domain_expire")'=>array('label'=>'Expire'),
'recur_schedule'=>array('label'=>'Billing'),
@ -352,7 +352,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
array(
'page'=>TRUE,
'type'=>'select',
'form'=>'user/service/view',
'form'=>URL::link('user','service/view'),
)),
));
}
@ -373,7 +373,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
$list[$sid],
25,
array(
'id'=>array('label'=>'ID','url'=>'user/service/view/'),
'id'=>array('label'=>'ID','url'=>URL::link('user','service/view/')),
'service_name()'=>array('label'=>'Details'),
'plugin()->domain_registrar->id'=>array('label'=>'SID'),
'plugin()->domain_registrar->name'=>array('label'=>'Supplier'),
@ -382,7 +382,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
array(
'page'=>TRUE,
'type'=>'select',
'form'=>'user/service/view',
'form'=>URL::link('user','service/view'),
)),
));
}
@ -397,7 +397,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
$svs,
25,
array(
'id'=>array('label'=>'ID','url'=>'user/service/view/'),
'id'=>array('label'=>'ID','url'=>URL::link('user','service/view/')),
'service_name()'=>array('label'=>'Details'),
'plugin()->display("host_expire")'=>array('label'=>'Expire'),
'recur_schedule'=>array('label'=>'Billing'),
@ -409,7 +409,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
array(
'page'=>TRUE,
'type'=>'select',
'form'=>'user/service/view',
'form'=>URL::link('user','service/view'),
)),
));
}
@ -430,7 +430,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
$list[$sid],
25,
array(
'id'=>array('label'=>'ID','url'=>'user/service/view/'),
'id'=>array('label'=>'ID','url'=>URL::link('user','service/view/')),
'service_name()'=>array('label'=>'Details'),
'plugin()->display("host_expire")'=>array('label'=>'Expire'),
'recur_schedule'=>array('label'=>'Billing'),
@ -442,7 +442,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
array(
'page'=>TRUE,
'type'=>'select',
'form'=>'user/service/view',
'form'=>URL::link('user','service/view'),
)),
));
}
@ -457,7 +457,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
$svs,
25,
array(
'id'=>array('label'=>'ID','url'=>'user/service/view/'),
'id'=>array('label'=>'ID','url'=>URL::link('user','service/view/')),
'service_name()'=>array('label'=>'Details'),
'recur_schedule'=>array('label'=>'Billing'),
'price(TRUE,TRUE)'=>array('label'=>'Price','class'=>'right'),
@ -468,7 +468,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
array(
'page'=>TRUE,
'type'=>'select',
'form'=>'user/service/view',
'form'=>URL::link('user','service/view'),
)),
));
}
@ -647,7 +647,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
ORM::factory('Service')->list_invoicesoon(ORM::factory('Invoice')->config('GEN_SOON_DAYS')),
25,
array(
'id'=>array('label'=>'ID','url'=>'user/service/view/'),
'id'=>array('label'=>'ID','url'=>URL::link('user','service/view/')),
'service_name()'=>array('label'=>'Details'),
'recur_schedule'=>array('label'=>'Billing'),
'date_next_invoice'=>array('label'=>'Next Invoice'),
@ -660,7 +660,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
array(
'page'=>TRUE,
'type'=>'select',
'form'=>'user/service/view',
'form'=>URL::link('user','service/view'),
)),
));
}
@ -779,7 +779,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
}
if (isset($_REQUEST['go']))
HTTP::redirect('admin/service/view/'.$so->id);
HTTP::redirect(URL::link('admin','service/view/'.$so->id));
Block::add(array(
'title'=>sprintf('Transaction History for %s: %s',$so->id(),$so->name()),

View File

@ -30,7 +30,7 @@ class Controller_Affiliate_Service extends Controller_TemplateDefault_Affiliate
$this->filter(ORM::factory('Service')->list_active(),$this->ao->affiliate->id),
25,
array(
'id'=>array('label'=>'ID','url'=>'user/service/view/'),
'id'=>array('label'=>'ID','url'=>URL::link('user','service/view/')),
'service_name()'=>array('label'=>'Details'),
'recur_schedule'=>array('label'=>'Billing'),
'price(TRUE,TRUE)'=>array('label'=>'Price','class'=>'right'),
@ -41,7 +41,7 @@ class Controller_Affiliate_Service extends Controller_TemplateDefault_Affiliate
array(
'page'=>TRUE,
'type'=>'select',
'form'=>'user/service/view',
'form'=>URL::link('user','service/view'),
)),
));
}
@ -67,7 +67,7 @@ class Controller_Affiliate_Service extends Controller_TemplateDefault_Affiliate
$svs,
25,
array(
'id'=>array('label'=>'ID','url'=>'user/service/view/'),
'id'=>array('label'=>'ID','url'=>URL::link('user','service/view/')),
'service_name()'=>array('label'=>'Details'),
'recur_schedule'=>array('label'=>'Billing'),
'price(TRUE,TRUE)'=>array('label'=>'Price','class'=>'right'),
@ -80,7 +80,7 @@ class Controller_Affiliate_Service extends Controller_TemplateDefault_Affiliate
array(
'page'=>TRUE,
'type'=>'select',
'form'=>'user/service/view',
'form'=>URL::link('user','service/view'),
)),
));
else
@ -104,7 +104,7 @@ class Controller_Affiliate_Service extends Controller_TemplateDefault_Affiliate
$svs,
25,
array(
'id'=>array('label'=>'ID','url'=>'user/service/view/'),
'id'=>array('label'=>'ID','url'=>URL::link('user','service/view/')),
'service_name()'=>array('label'=>'Details'),
'recur_schedule'=>array('label'=>'Billing'),
'price(TRUE,TRUE)'=>array('label'=>'Price','class'=>'right'),
@ -117,7 +117,7 @@ class Controller_Affiliate_Service extends Controller_TemplateDefault_Affiliate
array(
'page'=>TRUE,
'type'=>'select',
'form'=>'user/service/view',
'form'=>URL::link('user','service/view'),
)),
));
}
@ -176,7 +176,7 @@ class Controller_Affiliate_Service extends Controller_TemplateDefault_Affiliate
$svs,
NULL,
array(
'id'=>array('label'=>'ID','url'=>'user/service/view/'),
'id'=>array('label'=>'ID','url'=>URL::link('user','service/view/')),
'name()'=>array('label'=>'Service'),
'plugin()->ipaddress()'=>array('label'=>'IP Address'),
'product->plugin()->speed'=>array('label'=>'Speed'),
@ -191,7 +191,7 @@ class Controller_Affiliate_Service extends Controller_TemplateDefault_Affiliate
),
array(
'type'=>'select',
'form'=>'user/service/view',
'form'=>URL::link('user','service/view'),
)),
));
}
@ -217,7 +217,7 @@ class Controller_Affiliate_Service extends Controller_TemplateDefault_Affiliate
$svs,
NULL,
array(
'id'=>array('label'=>'ID','url'=>'user/service/view/'),
'id'=>array('label'=>'ID','url'=>URL::link('user','service/view/')),
'name()'=>array('label'=>'Service'),
'plugin()->ipaddress()'=>array('label'=>'IP Address'),
'product->plugin()->speed'=>array('label'=>'Speed'),
@ -232,7 +232,7 @@ class Controller_Affiliate_Service extends Controller_TemplateDefault_Affiliate
),
array(
'type'=>'select',
'form'=>'user/service/view',
'form'=>URL::link('user','service/view'),
)),
));
}
@ -244,7 +244,7 @@ class Controller_Affiliate_Service extends Controller_TemplateDefault_Affiliate
$this->filter(ORM::factory('Service')->list_bylistgroup('DOMAIN'),$this->ao->affiliate->id,'name()'),
25,
array(
'id'=>array('label'=>'ID','url'=>'user/service/view/'),
'id'=>array('label'=>'ID','url'=>URL::link('user','service/view/')),
'service_name()'=>array('label'=>'Details'),
'plugin()->display("domain_expire")'=>array('label'=>'Expire'),
'recur_schedule'=>array('label'=>'Billing'),
@ -256,7 +256,7 @@ class Controller_Affiliate_Service extends Controller_TemplateDefault_Affiliate
array(
'page'=>TRUE,
'type'=>'select',
'form'=>'user/service/view',
'form'=>URL::link('user','service/view'),
)),
));
}
@ -268,7 +268,7 @@ class Controller_Affiliate_Service extends Controller_TemplateDefault_Affiliate
$this->filter(ORM::factory('Service')->list_bylistgroup('HOST'),$this->ao->affiliate->id,'name()'),
25,
array(
'id'=>array('label'=>'ID','url'=>'user/service/view/'),
'id'=>array('label'=>'ID','url'=>URL::link('user','service/view/')),
'service_name()'=>array('label'=>'Details'),
'plugin()->display("host_expire")'=>array('label'=>'Expire'),
'recur_schedule'=>array('label'=>'Billing'),
@ -280,7 +280,7 @@ class Controller_Affiliate_Service extends Controller_TemplateDefault_Affiliate
array(
'page'=>TRUE,
'type'=>'select',
'form'=>'user/service/view',
'form'=>URL::link('user','service/view'),
)),
));
}

View File

@ -43,7 +43,7 @@ class Controller_User_Service extends Controller_TemplateDefault_User {
$this->ao->service->find_all(),
25,
array(
'id'=>array('label'=>'ID','url'=>'user/service/view/'),
'id'=>array('label'=>'ID','url'=>URL::link('user','service/view/')),
'service_name()'=>array('label'=>'Details'),
'recur_schedule'=>array('label'=>'Billing'),
'price(TRUE,TRUE)'=>array('label'=>'Price','class'=>'right'),
@ -52,7 +52,7 @@ class Controller_User_Service extends Controller_TemplateDefault_User {
array(
'page'=>TRUE,
'type'=>'select',
'form'=>'user/service/view',
'form'=>URL::link('user','service/view'),
)),
));
}

View File

@ -66,7 +66,7 @@ abstract class Model_Service_Plugin extends ORM_OSB {
$("button[name=submit]").click(function() {
var t=$(this).val().split(":");
if (x++) { alert("Session expired, please refresh the page!"); return false; }
$.getJSON("'.URL::site('user/service/ajaxmanage/'.$this->service_id).'", { k: "'.$k.'",t: t[1] }, function(data) {
$.getJSON("'.URL::link('user','service/ajaxmanage/'.$this->service_id,TRUE).'", { k: "'.$k.'",t: t[1] }, function(data) {
$.each(data, function(key, val) { $("#"+key+"_"+t[0]+"_"+t[1]).val(val); });
}).error(function() { alert("There was a problem with the request"); return false; }).success(
function() { $("form[id=id_"+t[0]+"_"+t[1]+"]").submit(); });

View File

@ -26,7 +26,7 @@ Pending change to: <?php echo $so->service_change->list_details(); ?>
<?php } ?>
<tr class="list-data">
<td class="id"><?php echo $iio->id; ?></td>
<td><?php echo HTML::anchor('/user/invoice/view/'.$iio->invoice_id,$iio->invoice_id); ?></td>
<td><?php echo HTML::anchor(URL::link('user','invoice/view/'.$iio->invoice_id),$iio->invoice_id); ?></td>
<td><?php echo $iio->display('product_id'); ?></td>
<td><?php echo $iio->display('item_type'); ?></td>
<td><?php echo $iio->display('recurring_schedule'); ?></td>

View File

@ -69,8 +69,8 @@
</tr>
<?php $i=0; foreach ($so->invoice->distinct('id')->order_by('id DESC')->find_all() as $io) { ?>
<tr class="<?php echo $i++%2 ? 'odd' : 'even'; ?>">
<td class="icon" width="20px"><?php echo HTML::anchor('/user/invoice/download/'.$io->id,HTML::image('media/img/gnome-pdf.png',array('alt'=>_('Download'),'width'=>20))); ?></td>
<td class="data"><?php echo HTML::anchor('/user/invoice/view/'.$io->id,$io->id()); ?></td>
<td class="icon" width="20px"><?php echo HTML::anchor(URL::link('user','invoice/download/'.$io->id),HTML::image('media/img/gnome-pdf.png',array('alt'=>_('Download'),'width'=>20))); ?></td>
<td class="data"><?php echo HTML::anchor(URL::link('user','invoice/view/'.$io->id),$io->id()); ?></td>
<td class="data"><?php echo $io->display('date_orig'); ?></td>
<td class="data"><?php echo $io->display('due_date'); ?></td>
<td class="data"><?php echo $io->total(TRUE); ?></td>

View File

@ -24,7 +24,7 @@ class Controller_Admin_SSL extends Controller_TemplateDefault_Admin {
ORM::factory('SSL_CA')->find_all(),
25,
array(
'id'=>array('label'=>'ID','url'=>'admin/ssl/view/'),
'id'=>array('label'=>'ID','url'=>URL::link('admin','ssl/view/')),
'sign_cert'=>array('label'=>'Cert'),
'issuer()'=>array('label'=>'Issuer'),
'valid_to(TRUE)'=>array('label'=>'Expires'),
@ -32,7 +32,7 @@ class Controller_Admin_SSL extends Controller_TemplateDefault_Admin {
array(
'page'=>TRUE,
'type'=>'select',
'form'=>'admin/ssl/view',
'form'=>URL::link('admin','ssl/view'),
)),
));
}
@ -94,14 +94,14 @@ class Controller_Admin_SSL extends Controller_TemplateDefault_Admin {
ORM::factory('SSL_CA',$id)->list_issued(),
25,
array(
'id'=>array('label'=>'ID','url'=>'admin/service/view/'),
'id'=>array('label'=>'ID','url'=>URL::link('admin','service/view/')),
'plugin()->dn()'=>array('label'=>'Cert'),
'plugin()->valid_to(TRUE)'=>array('label'=>'Expires'),
),
array(
'page'=>TRUE,
'type'=>'select',
'form'=>'admin/service/view',
'form'=>URL::link('admin','service/view'),
)),
));

View File

@ -30,7 +30,7 @@ class Controller_User_SSL extends Controller_TemplateDefault_User {
'body'=>_('Your requested password is too short.'),
));
HTTP::redirect('user/service/view/'.$so->id);
HTTP::redirect(URL::link('user','service/view/'.$so->id));
}
if (! $so->loaded() OR ! Auth::instance()->authorised($so->account_id,$so->affiliate_id)) {

View File

@ -112,7 +112,7 @@ class Model_Service_Plugin_Ssl extends Model_Service_Plugin {
return '';
// @todo Do some password validation
$output = Form::open('user/ssl/download');
$output = Form::open(URL::link('user','ssl/download'));
$output .= Form::hidden('sid',$this->service->id);
$output .= _('Choose a password').': '.Form::password('passwd','').'<br/><br/>';
$output .= Form::submit('download','Download',array('class'=>'form_button'));

View File

@ -2,7 +2,7 @@
<?php if (isset($o['invoice'])) { ?>
<td><?php echo $o['invoice']->display('date_orig'); ?></td>
<td>Invoice</td>
<td><?php echo HTML::anchor('user/invoice/view/'.$o['invoice']->id,$o['invoice']->id()); ?></td>
<td><?php echo HTML::anchor(URL::link('user','invoice/view/'.$o['invoice']->id),$o['invoice']->id()); ?></td>
<td class="right"><?php echo $o['invoice']->total(TRUE); ?></td>
<?php } elseif (isset($o['payment'])) { ?>
<td><?php echo $o['payment']->display('date_payment'); ?></td>

View File

@ -25,7 +25,7 @@ class Controller_Admin_Task extends Controller_TemplateDefault_Admin {
ORM::factory('Task_Log')->order_by('id','DESC')->find_all(),
25,
array(
'id'=>array('label'=>'ID','url'=>'admin/task/view/'),
'id'=>array('label'=>'ID','url'=>URL::link('admin','task/view/')),
'date_orig'=>array('label'=>'Date'),
'task->display("name")'=>array('label'=>'Task'),
'result'=>array('label'=>'Result'),