diff --git a/system/boot.php b/system/boot.php index 1fb230b5..68ace47c 100644 --- a/system/boot.php +++ b/system/boot.php @@ -102,11 +102,11 @@ try { } } if (!empty($radius_user)) { - ORM::configure("mysql:host=$radius_host;dbname=$radius_name", null, 'rad'); - ORM::configure('username', $radius_user, 'rad'); - ORM::configure('password', $radius_pass, 'rad'); - ORM::configure('driver_options', array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'), 'rad'); - ORM::configure('return_result_sets', true, 'rad'); + ORM::configure("mysql:host=$radius_host;dbname=$radius_name", null, 'radius'); + ORM::configure('username', $radius_user, 'radius'); + ORM::configure('password', $radius_pass, 'radius'); + ORM::configure('driver_options', array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'), 'radius'); + ORM::configure('return_result_sets', true, 'radius'); } } catch (Exception $e) { $ui = new Smarty(); diff --git a/system/controllers/prepaid.php b/system/controllers/prepaid.php index 6dd0709f..3aae837c 100644 --- a/system/controllers/prepaid.php +++ b/system/controllers/prepaid.php @@ -37,8 +37,6 @@ document.addEventListener("DOMContentLoaded", function(event) { EOT; -require_once 'system/autoload/PEAR2/Autoload.php'; - switch ($action) { case 'sync': set_time_limit(-1); diff --git a/system/controllers/radius.php b/system/controllers/radius.php new file mode 100644 index 00000000..d3479fe5 --- /dev/null +++ b/system/controllers/radius.php @@ -0,0 +1,84 @@ +assign('_title', $_L['Plugin Manager']); +$ui->assign('_system_menu', 'settings'); + +$action = $routes['1']; +$admin = Admin::_info(); +$ui->assign('_admin', $admin); + + +if ($admin['user_type'] != 'Admin') { + r2(U . "dashboard", 'e', $_L['Do_Not_Access']); +} + +switch ($action) { + + case 'nas-list': + $ui->assign('_system_menu', 'network'); + $ui->assign('_title', "Network Access Server"); + $nas = ORM::for_table('nas', 'radius')->find_many(); + $ui->assign('nas', $nas); + $ui->display('radius-nas.tpl'); + case 'nas-add': + $ui->assign('_system_menu', 'network'); + $ui->assign('_title', "Network Access Server"); + $ui->display('radius-nas-add.tpl'); + case 'nas-add-post': + $shortname = _post('shortname'); + $nasname = _post('nasname'); + $secret = _post('secret'); + $ports = _post('ports', null); + $type = _post('type', 'other'); + $server = _post('server', null); + $community = _post('community', null); + $description = _post('description'); + $msg = ''; + + if (Validator::Length($shortname, 30, 2) == false) { + $msg .= 'Name should be between 3 to 30 characters' . '
'; + } + if (empty($ports)) { + $ports = null; + } + if (empty($server)) { + $server = null; + } + if (empty($community)) { + $community = null; + } + if (empty($type)) { + $type = null; + } + $d = ORM::for_table('nas', 'radius')->where('nasname', $nasname)->find_one(); + if ($d) { + $msg .= 'NAS IP Exists
'; + } + if ($msg == '') { + $b = ORM::for_table('nas', 'radius')->create(); + $b->nasname = $nasname; + $b->shortname = $shortname; + $b->secret = $secret; + $b->ports = $ports; + $b->type = $type; + $b->server = $server; + $b->community = $community; + $b->description = $description; + $b->save(); + $id = $b->id(); + if($id>0){ + r2(U . 'radius/nas-edit/'.$id, 's', "NAS Added"); + }else{ + r2(U . 'radius/nas-add/', 'e', "NAS Added Failed"); + } + }else{ + r2(U . 'radius/nas-add', 'e', $msg); + } + default: + $ui->display('a404.tpl'); +} diff --git a/ui/ui/radius-nas-add.tpl b/ui/ui/radius-nas-add.tpl new file mode 100644 index 00000000..27c18e8b --- /dev/null +++ b/ui/ui/radius-nas-add.tpl @@ -0,0 +1,74 @@ +{include file="sections/header.tpl"} + + +
+
+
+
Radius - Add NAS
+
+ +
+
+ +
+ +

{Lang::T('Name of Area that router operated')}

+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+ +
+ +
+
+
+ +
+ +
+ +
+ +
+
+
+ +
+ +

{Lang::T('Explain Coverage of router')}

+
+
+
+
+ + Or {$_L['Cancel']} +
+
+
+ +
+
+
+
+ +{include file="sections/footer.tpl"} \ No newline at end of file