diff --git a/system/autoload/Lang.php b/system/autoload/Lang.php index ad91e02f..2e1ac016 100644 --- a/system/autoload/Lang.php +++ b/system/autoload/Lang.php @@ -19,55 +19,63 @@ class Lang public static function moneyFormat($var) { global $config; - return $config['currency_code'] . ' ' .number_format($var, 0, $config['dec_point'], $config['thousands_sep']); + return $config['currency_code'] . ' ' . number_format($var, 0, $config['dec_point'], $config['thousands_sep']); } public static function phoneFormat($phone) { global $config; - if(Validator::UnsignedNumber($phone) && !empty($config['country_code_phone'])){ + if (Validator::UnsignedNumber($phone) && !empty($config['country_code_phone'])) { return preg_replace('/^0/', $config['country_code_phone'], $phone); - }else{ + } else { return $phone; } } - public static function dateFormat($date){ + public static function dateFormat($date) + { global $config; return date($config['date_format'], strtotime($date)); } - public static function dateTimeFormat($date){ + public static function dateTimeFormat($date) + { global $config; - if(strtotime($date) < strtotime("2000-01-01 00:00:00")){ + if (strtotime($date) < strtotime("2000-01-01 00:00:00")) { return ""; - }else{ - return date($config['date_format']. ' H:i', strtotime($date)); + } else { + return date($config['date_format'] . ' H:i', strtotime($date)); } } - public static function dateAndTimeFormat($date, $time){ + public static function dateAndTimeFormat($date, $time) + { global $config; - return date($config['date_format']. ' H:i', strtotime("$date $time")); + return date($config['date_format'] . ' H:i', strtotime("$date $time")); } - public static function nl2br($text){ + public static function nl2br($text) + { return nl2br($text); } - public static function arrayCount($arr){ - if(is_array($arr)){ + public static function arrayCount($arr) + { + if (is_array($arr)) { return count($arr); - }else{ + } else if (is_object($arr)) { + return count($arr); + } else { return 0; } } - public static function getNotifText($key){ + public static function getNotifText($key) + { global $_notifmsg, $_notifmsg_default; - if(isset($_notifmsg[$key])){ + if (isset($_notifmsg[$key])) { return $_notifmsg[$key]; - }else{ + } else { return $_notifmsg_default[$key]; } } diff --git a/system/controllers/order.php b/system/controllers/order.php index 5460d791..65fcf92b 100644 --- a/system/controllers/order.php +++ b/system/controllers/order.php @@ -36,20 +36,30 @@ switch ($action) { $ui->assign('_title', 'Order Plan'); $ui->assign('_system_menu', 'package'); if(!empty($_SESSION['nux-router'])){ - $routers = ORM::for_table('tbl_routers')->where('id',$_SESSION['nux-router'])->find_many(); - $rs = []; - foreach($routers as $r){ - $rs[] = $r['name']; + if($_SESSION['nux-router']=='radius'){ + $radius_pppoe = ORM::for_table('tbl_plans')->where('enabled', '1')->where('is_radius',1)->where('type', 'PPPOE')->find_many(); + $radius_hotspot = ORM::for_table('tbl_plans')->where('enabled', '1')->where('is_radius',1)->where('type', 'Hotspot')->find_many(); + }else{ + $routers = ORM::for_table('tbl_routers')->where('id',$_SESSION['nux-router'])->find_many(); + $rs = []; + foreach($routers as $r){ + $rs[] = $r['name']; + } + $plans_pppoe = ORM::for_table('tbl_plans')->where('enabled', '1')->where_in('routers', $rs)->where('is_radius',0)->where('type', 'PPPOE')->find_many(); + $plans_hotspot = ORM::for_table('tbl_plans')->where('enabled', '1')->where_in('routers', $rs)->where('is_radius',0)->where('type', 'Hotspot')->find_many(); } - $plans_pppoe = ORM::for_table('tbl_plans')->where('enabled', '1')->where_in('routers', $rs)->where('type', 'PPPOE')->find_many(); - $plans_hotspot = ORM::for_table('tbl_plans')->where('enabled', '1')->where_in('routers', $rs)->where('type', 'Hotspot')->find_many(); }else{ + $radius_pppoe = ORM::for_table('tbl_plans')->where('enabled', '1')->where('is_radius',1)->where('type', 'PPPOE')->find_many(); + $radius_hotspot = ORM::for_table('tbl_plans')->where('enabled', '1')->where('is_radius',1)->where('type', 'Hotspot')->find_many(); + $routers = ORM::for_table('tbl_routers')->find_many(); - $plans_pppoe = ORM::for_table('tbl_plans')->where('enabled', '1')->where('type', 'PPPOE')->find_many(); - $plans_hotspot = ORM::for_table('tbl_plans')->where('enabled', '1')->where('type', 'Hotspot')->find_many(); + $plans_pppoe = ORM::for_table('tbl_plans')->where('enabled', '1')->where('is_radius',0)->where('type', 'PPPOE')->find_many(); + $plans_hotspot = ORM::for_table('tbl_plans')->where('enabled', '1')->where('is_radius',0)->where('type', 'Hotspot')->find_many(); } $plans_balance = ORM::for_table('tbl_plans')->where('enabled', '1')->where('type', 'Balance')->find_many(); $ui->assign('routers', $routers); + $ui->assign('radius_pppoe', $radius_pppoe); + $ui->assign('radius_hotspot', $radius_hotspot); $ui->assign('plans_pppoe', $plans_pppoe); $ui->assign('plans_hotspot', $plans_hotspot); $ui->assign('plans_balance', $plans_balance); diff --git a/system/controllers/settings.php b/system/controllers/settings.php index 196a5c2d..49f69611 100644 --- a/system/controllers/settings.php +++ b/system/controllers/settings.php @@ -477,7 +477,6 @@ switch ($action) { $d->save(); } - $d = ORM::for_table('tbl_appconfig')->where('setting', 'country_code_phone')->find_one(); if ($d) { $d->value = $country_code_phone; @@ -489,6 +488,37 @@ switch ($action) { $d->save(); } + $d = ORM::for_table('tbl_appconfig')->where('setting', 'radius_plan')->find_one(); + if ($d) { + $d->value = _post('radius_plan'); + $d->save(); + } else { + $d = ORM::for_table('tbl_appconfig')->create(); + $d->setting = 'radius_plan'; + $d->value = _post('radius_plan'); + $d->save(); + } + $d = ORM::for_table('tbl_appconfig')->where('setting', 'hotspot_plan')->find_one(); + if ($d) { + $d->value = _post('hotspot_plan'); + $d->save(); + } else { + $d = ORM::for_table('tbl_appconfig')->create(); + $d->setting = 'hotspot_plan'; + $d->value = _post('hotspot_plan'); + $d->save(); + } + $d = ORM::for_table('tbl_appconfig')->where('setting', 'pppoe_plan')->find_one(); + if ($d) { + $d->value = _post('pppoe_plan'); + $d->save(); + } else { + $d = ORM::for_table('tbl_appconfig')->create(); + $d->setting = 'pppoe_plan'; + $d->value = _post('pppoe_plan'); + $d->save(); + } + $currency_code = $_POST['currency_code']; $d = ORM::for_table('tbl_appconfig')->where('setting', 'currency_code')->find_one(); $d->value = $currency_code; diff --git a/system/lan/english/common.lan.php b/system/lan/english/common.lan.php index 2ea8383d..48ba9e92 100644 --- a/system/lan/english/common.lan.php +++ b/system/lan/english/common.lan.php @@ -404,3 +404,4 @@ $_L['Sync'] = 'Sync'; $_L['Failed_to_create_PaymeTrust_transaction'] = 'Failed to create PaymeTrust transaction.'; $_L['Location'] = 'Location'; $_L['Radius_Plans'] = 'Radius Plans'; +$_L['Change_title_in_user_Plan_order'] = 'Change title in user Plan order'; diff --git a/ui/ui/app-localisation.tpl b/ui/ui/app-localisation.tpl index 0adf9961..44d42ed9 100644 --- a/ui/ui/app-localisation.tpl +++ b/ui/ui/app-localisation.tpl @@ -48,8 +48,8 @@
@@ -89,6 +89,31 @@ +
+
+ +
+ +
+ {Lang::T('Change title in user Plan order')} +
+
+ +
+ +
+ {Lang::T('Change title in user Plan order')} +
+
+ +
+ +
+ {Lang::T('Change title in user Plan order')} +
{/if} + {if $_c['radius_enable']} +
+
{if $_c['radius_plan']==''}Radius + Plan{else}{$_c['radius_plan']} + {/if}
+ {if Lang::arrayCount($radius_hotspot)>0} +
{if $_c['hotspot_plan']==''}Hotspot Plan{else}{$_c['hotspot_plan']}{/if}
+
+ {foreach $radius_hotspot as $plan} +
+
+
{$plan['name_plan']}
+
+ + + + + + + + + + + + + + + +
{Lang::T('Type')}{$plan['type']}
{Lang::T('Price')}{Lang::moneyFormat($plan['price'])}
{Lang::T('Validity')}{$plan['validity']} {$plan['validity_unit']}
+
+
+
+ Buy + {if $_c['enable_balance'] == 'yes' && $_user['balance']>=$plan['price']} + {Lang::T('Pay With Balance')} + {/if} +
+ {if $_c['enable_balance'] == 'yes' && $_c['allow_balance_transfer'] == 'yes' && $_user['balance']>=$plan['price']} + {Lang::T('Buy for friend')} + {/if} +
+
+
+ {/foreach} +
+ {/if} + {if Lang::arrayCount($radius_pppoe)>0} +
{if $_c['pppoe_plan']==''}PPPOE Plan{else}{$_c['pppoe_plan']}{/if}
+
+ {foreach $radius_pppoe as $plan} +
+
+
{$plan['name_plan']}
+
+ + + + + + + + + + + + + + + +
{Lang::T('Type')}{$plan['type']}
{Lang::T('Price')}{Lang::moneyFormat($plan['price'])}
{Lang::T('Validity')}{$plan['validity']} {$plan['validity_unit']}
+
+
+
+ Buy + {if $_c['enable_balance'] == 'yes' && $_user['balance']>=$plan['price']} + {Lang::T('Pay With Balance')} + {/if} +
+ {if $_c['enable_balance'] == 'yes' && $_c['allow_balance_transfer'] == 'yes' && $_user['balance']>=$plan['price']} + {Lang::T('Buy for friend')} + {/if} +
+
+
+ {/foreach} +
+ {/if} +
+ {/if} {foreach $routers as $router} {if Validator::isRouterHasPlan($plans_hotspot, $router['name']) || Validator::isRouterHasPlan($plans_pppoe, $router['name'])}
@@ -44,7 +145,7 @@
{/if} {if Validator::countRouterPlan($plans_hotspot, $router['name'])>0} -
{Lang::T('Hotspot Plan')}
+
{if $_c['hotspot_plan']==''}Hotspot Plan{else}{$_c['hotspot_plan']}{/if}
{foreach $plans_hotspot as $plan} {if $router['name'] eq $plan['routers']} @@ -93,7 +194,7 @@
{/if} {if Validator::countRouterPlan($plans_pppoe,$router['name'])>0} -
{Lang::T('PPPOE Plan')}
+
{if $_c['pppoe_plan']==''}PPPOE Plan{else}{$_c['pppoe_plan']}{/if}
{foreach $plans_pppoe as $plan} {if $router['name'] eq $plan['routers']} @@ -146,4 +247,5 @@ {/foreach}
+ {include file="sections/user-footer.tpl"} \ No newline at end of file