Compare commits

...

22 Commits

Author SHA1 Message Date
db240131e2 2024.1.11 2024-01-11 15:56:43 +07:00
2fdc3c9567 Merge pull request #94 from Focuslinkstech/master
Allow Package Purchase Option Added.
admin can now decide if clients can purchase a particular package or not.

if No option is selected the package wont display in the package list
2024-01-11 15:41:52 +07:00
a953157b68 fix plugin manager 2024-01-11 10:07:56 +07:00
4ba38485a0 New Feature Added
Allow Package Purchase Option Added.
admin can now decide if user can purchase a particular package or not.

if no option is selected the package wont display in the package list
2024-01-11 01:00:34 +01:00
dfef6807a5 Merge branch 'master' of https://github.com/Focuslinkstech/phpnuxbill 2024-01-11 00:47:38 +01:00
5ef0520c74 Update updates.json
Database : add allow purchase
2024-01-11 00:47:17 +01:00
263a1b6722 Merge branch 'hotspotbilling:master' into master 2024-01-11 00:30:28 +01:00
f4c5b6a8bb Update user-dashboard.tpl
fix typo error
2024-01-10 11:51:57 +01:00
05ed37d3d8 2024.1.9 2024-01-09 10:34:19 +07:00
055b855bc1 Delete Used Voucher which not exists in tbl recharges 2024-01-08 16:12:21 +07:00
b862a759d0 Add Prefix 2024-01-08 15:39:04 +07:00
41cc04cffb 2024.1.8 2024-01-08 15:28:13 +07:00
1d29f8111e Order Expired by Expired date 2024-01-08 15:24:35 +07:00
081dd1b1b9 add nasreload table 2024-01-02 13:51:26 +07:00
9804bcb9e8 log class 2024-01-02 13:35:06 +07:00
19e39dbefc templat bug report and Feature Request 2024-01-02 11:42:08 +07:00
b5c29f6c3d Merge remote-tracking branch 'origin/Development' into Development 2024-01-02 11:35:20 +07:00
fe94ae3011 2024.1.2 2024-01-02 11:34:23 +07:00
a25112a37f add paginator
add paginator to dashboard expire user list
2024-01-02 11:33:28 +07:00
9d1d287e9a 2024.1.2 2024-01-02 11:31:41 +07:00
4bddaf0260 Merge pull request #86 from Focuslinkstech/master
add paginator
2024-01-02 11:28:27 +07:00
43ed5e452e add paginator
add paginator to dashboard expire user list
2023-12-27 20:10:56 +01:00
27 changed files with 270 additions and 103 deletions

View File

@ -7,6 +7,9 @@ assignees: ibnux
---
Please Remember, this project is free and open source, and @ibnux don't get any money from this project, and if you post something not a bug, just you dont understand how to install it, you will get blocked from this Repository.
Post it in Discussion if you don't understand. Except you pay for $50 for support
**Describe the bug**
A clear and concise description of what the bug is. Error connecting to router is not a bug, is your router port is not accessable, ask community for help, go to discussion or telegram group

View File

@ -7,6 +7,8 @@ assignees: ''
---
Please Remember, this project is free and open source, and @ibnux don't get any money from this project, any Feature Request will cost you $50-$5000
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

View File

@ -2,6 +2,23 @@
# CHANGELOG
## 2024.1.11
- Add Plan only for admin by @Focuslinkstech
- Fix Plugin Manager
## 2024.1.9
- Add Prefix when generate Voucher
## 2024.1.8
- User Expired Order by Expired Date
## 2024.1.2
- Pagination User Expired by @Focuslinkstech
## 2023.12.21
- Modern AdminLTE by @sabtech254

View File

@ -102,6 +102,13 @@ CREATE TABLE `radusergroup` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
DROP TABLE IF EXISTS `nasreload`;
CREATE TABLE `nasreload` (
nasipaddress varchar(15) NOT NULL,
reloadtime datetime NOT NULL,
PRIMARY KEY (nasipaddress)
) ENGINE = INNODB;
ALTER TABLE `nas`
ADD PRIMARY KEY (`id`),
ADD KEY `nasname` (`nasname`);

32
system/autoload/Log.php Normal file
View File

@ -0,0 +1,32 @@
<?php
/**
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
* by https://t.me/ibnux
**/
class Log{
public static function put($type, $description, $userid = '', $username = '')
{
$d = ORM::for_table('tbl_logs')->create();
$d->date = date('Y-m-d H:i:s');
$d->type = $type;
$d->description = $description;
$d->userid = $userid;
$d->ip = (empty($username)) ? $_SERVER["REMOTE_ADDR"] : $username;
$d->save();
}
public static function arrayToText($array, $start = '', $result = '')
{
foreach ($array as $k => $v) {
if (is_array($v)) {
$result = Log::arrayToText($v, "$start$k.", $result);
} else {
$result .= $start.$k ." : ". strval($v) ."\n";
}
}
return $result;
}
}

View File

@ -223,13 +223,7 @@ function _admin($login = true)
function _log($description, $type = '', $userid = '0')
{
$d = ORM::for_table('tbl_logs')->create();
$d->date = date('Y-m-d H:i:s');
$d->type = $type;
$d->description = $description;
$d->userid = $userid;
$d->ip = $_SERVER["REMOTE_ADDR"];
$d->save();
Log::put($type, $description, $userid);
}
function Lang($key)

View File

@ -52,7 +52,24 @@ if (empty($c_all)) {
$ui->assign('c_all', $c_all);
//user expire
$expire = ORM::for_table('tbl_user_recharges')->whereLte('expiration', $mdate)->order_by_desc('id')->limit(30)->find_many();
$paginator = Paginator::build(ORM::for_table('tbl_user_recharges'));
$expire = ORM::for_table('tbl_user_recharges')
->where_lte('expiration', $mdate)
->offset($paginator['startpoint'])
->limit($paginator['limit'])
->order_by_desc('expiration')
->find_many();
// Get the total count of expired records for pagination
$totalCount = ORM::for_table('tbl_user_recharges')
->where_lte('expiration', $mdate)
->count();
// Pass the total count and current page to the paginator
$paginator['total_count'] = $totalCount;
// Assign the pagination HTML to the template variable
$ui->assign('paginator', $paginator);
$ui->assign('expire', $expire);
//activity log

View File

@ -90,29 +90,29 @@ if (_post('send') == 'balance') {
$ui->assign('_bills', User::_billing());
if(isset($_GET['recharge']) && !empty($_GET['recharge'])){
if (isset($_GET['recharge']) && !empty($_GET['recharge'])) {
$bill = ORM::for_table('tbl_user_recharges')->where('id', $_GET['recharge'])->where('username', $user['username'])->findOne();
if ($bill) {
$router = ORM::for_table('tbl_routers')->where('name', $bill['routers'])->find_one();
if ($config['enable_balance'] == 'yes') {
$plan = ORM::for_table('tbl_plans')->find_one($bill['plan_id']);
if($user['balance']>$plan['price']){
if ($user['balance'] > $plan['price']) {
r2(U . "order/pay/$router[id]/$bill[plan_id]", 'e', 'Order Plan');
}else{
} else {
r2(U . "order/buy/$router[id]/$bill[plan_id]", 'e', 'Order Plan');
}
}else{
} else {
r2(U . "order/buy/$router[id]/$bill[plan_id]", 'e', 'Order Plan');
}
}
}else if(isset($_GET['deactivate']) && !empty($_GET['deactivate'])){
} else if (isset($_GET['deactivate']) && !empty($_GET['deactivate'])) {
$bill = ORM::for_table('tbl_user_recharges')->where('id', $_GET['deactivate'])->where('username', $user['username'])->findOne();
if ($bill) {
$p = ORM::for_table('tbl_plans')->where('id', $bill['plan_id'])->find_one();
if($p['is_radius']){
if ($p['is_radius']) {
Radius::customerDeactivate($user['username']);
}else{
try{
} else {
try {
$mikrotik = Mikrotik::info($bill['routers']);
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
if ($bill['type'] == 'Hotspot') {
@ -122,7 +122,7 @@ if(isset($_GET['recharge']) && !empty($_GET['recharge'])){
Mikrotik::removePpoeUser($client, $bill['username']);
Mikrotik::removePpoeActive($client, $bill['username']);
}
}catch(Exception $e){
} catch (Exception $e) {
//ignore it maybe mikrotik has been deleted
}
}
@ -130,10 +130,10 @@ if(isset($_GET['recharge']) && !empty($_GET['recharge'])){
$bill->expiration = date('Y-m-d');
$bill->time = date('H:i:s');
$bill->save();
_log('User ' . $bill['username'] . ' Deactivate '.$bill['namebp'], 'User', $bill['customer_id']);
Message::sendTelegram('User u' . $bill['username'] . ' Deactivate '.$bill['namebp']);
r2(U . 'home', 's', 'Success deactivate '.$bill['namebp']);
}else{
_log('User ' . $bill['username'] . ' Deactivate ' . $bill['namebp'], 'User', $bill['customer_id']);
Message::sendTelegram('User u' . $bill['username'] . ' Deactivate ' . $bill['namebp']);
r2(U . 'home', 's', 'Success deactivate ' . $bill['namebp']);
} else {
r2(U . 'home', 'e', 'No Active Plan');
}
}

View File

@ -47,7 +47,7 @@ switch ($do) {
$username = _post('username');
$v1 = ORM::for_table('tbl_voucher')->where('code', $voucher)->find_one();
if ($v1) {
// coucher exists, check customer exists or not
// voucher exists, check customer exists or not
$user = ORM::for_table('tbl_customers')->where('username', $username)->find_one();
if (!$user) {
$d = ORM::for_table('tbl_customers')->create();
@ -63,7 +63,7 @@ switch ($do) {
r2(U . 'login', 'e', Lang::T('Voucher activation failed'));
}
} else {
r2(U . 'login', 'e', Lang::T('Voucher activation failed').'.');
r2(U . 'login', 'e', Lang::T('Voucher activation failed') . '.');
}
}
if ($v1['status'] == 0) {
@ -72,32 +72,34 @@ switch ($do) {
$user->password = $voucher;
$user->save();
// voucher activation
if (Package::rechargeUser($user['id'], $v1['routers'], $v1['id_plan'], "Activation", "Voucher")) {
if (Package::rechargeUser($user['id'], $v1['routers'], $v1['id_plan'], "Voucher", $voucher)) {
$v1->status = "1";
$v1->user = $user['username'];
$v1->save();
$user->last_login = date('Y-m-d H:i:s');
$user->save();
// add customer to mikrotik
if (!empty($_SESSION['nux-mac']) && !empty($_SESSION['nux-ip'])) {
try{
try {
$m = Mikrotik::info($v1['routers']);
$c = Mikrotik::getClient($m['ip_address'], $m['username'], $m['password']);
Mikrotik::logMeIn($c, $user['username'], $user['password'], $_SESSION['nux-ip'], $_SESSION['nux-mac']);
if(!empty($config['voucher_redirect'])){
if (!empty($config['voucher_redirect'])) {
r2($config['voucher_redirect'], 's', Lang::T("Voucher activation success, you are connected to internet"));
}else{
} else {
r2(U . "login", 's', Lang::T("Voucher activation success, you are connected to internet"));
}
} catch (Exception $e) {
if(!empty($config['voucher_redirect'])){
if (!empty($config['voucher_redirect'])) {
r2($config['voucher_redirect'], 's', Lang::T("Voucher activation success, now you can login"));
}else{
} else {
r2(U . "login", 's', Lang::T("Voucher activation success, now you can login"));
}
}
}
if(!empty($config['voucher_redirect'])){
if (!empty($config['voucher_redirect'])) {
r2($config['voucher_redirect'], 's', Lang::T("Voucher activation success, now you can login"));
}else{
} else {
r2(U . "login", 's', Lang::T("Voucher activation success, now you can login"));
}
} else {
@ -110,27 +112,29 @@ switch ($do) {
// used voucher
// check if voucher used by this username
if ($v1['user'] == $user['username']) {
$user->last_login = date('Y-m-d H:i:s');
$user->save();
if (!empty($_SESSION['nux-mac']) && !empty($_SESSION['nux-ip'])) {
try{
try {
$m = Mikrotik::info($v1['routers']);
$c = Mikrotik::getClient($m['ip_address'], $m['username'], $m['password']);
Mikrotik::logMeIn($c, $user['username'], $user['password'], $_SESSION['nux-ip'], $_SESSION['nux-mac']);
if(!empty($config['voucher_redirect'])){
if (!empty($config['voucher_redirect'])) {
r2($config['voucher_redirect'], 's', Lang::T("Voucher activation success, you are connected to internet"));
}else{
} else {
r2(U . "login", 's', Lang::T("Voucher activation success, now you can login"));
}
} catch (Exception $e) {
if(!empty($config['voucher_redirect'])){
if (!empty($config['voucher_redirect'])) {
r2($config['voucher_redirect'], 's', Lang::T("Voucher activation success, now you can login"));
}else{
} else {
r2(U . "login", 's', Lang::T("Voucher activation success, now you can login"));
}
}
}else{
if(!empty($config['voucher_redirect'])){
} else {
if (!empty($config['voucher_redirect'])) {
r2($config['voucher_redirect'], 's', Lang::T("Voucher activation success, you are connected to internet"));
}else{
} else {
r2(U . "login", 's', Lang::T("Voucher activation success, now you can login"));
}
}
@ -140,14 +144,14 @@ switch ($do) {
}
}
} else {
// voucher not found
r2(U . 'login', 'e', $_L['Voucher_Not_Valid']);
_msglog('e', $_L['Invalid_Username_or_Password']);
r2(U . 'login');
}
default:
run_hook('customer_view_login'); #HOOK
if($config['disable_registration']=='yes'){
if ($config['disable_registration'] == 'yes') {
$ui->display('user-login-noreg.tpl');
}else{
} else {
$ui->display('user-login.tpl');
}
break;

View File

@ -37,7 +37,7 @@ switch ($action) {
}
$ui->assign('_title', 'Top Up');
$ui->assign('_system_menu', 'balance');
$plans_balance = ORM::for_table('tbl_plans')->where('enabled', '1')->where('type', 'Balance')->find_many();
$plans_balance = ORM::for_table('tbl_plans')->where('enabled', '1')->where('type', 'Balance')->where('allow_purchase', 'yes')->find_many();
$ui->assign('plans_balance', $plans_balance);
$ui->display('user-orderBalance.tpl');
break;
@ -49,24 +49,24 @@ switch ($action) {
$ui->assign('_system_menu', 'package');
if (!empty($_SESSION['nux-router'])) {
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();
$radius_pppoe = ORM::for_table('tbl_plans')->where('enabled', '1')->where('is_radius', 1)->where('type', 'PPPOE')->where('allow_purchase', 'yes')->find_many();
$radius_hotspot = ORM::for_table('tbl_plans')->where('enabled', '1')->where('is_radius', 1)->where('type', 'Hotspot')->where('allow_purchase', 'yes')->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('is_radius', 0)->where('type', 'PPPOE')->where('allow_purchase', 'yes')->find_many();
$plans_hotspot = ORM::for_table('tbl_plans')->where('enabled', '1')->where_in('routers', $rs)->where('is_radius', 0)->where('type', 'Hotspot')->where('allow_purchase', 'yes')->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();
$radius_pppoe = ORM::for_table('tbl_plans')->where('enabled', '1')->where('is_radius', 1)->where('type', 'PPPOE')->where('allow_purchase', 'yes')->find_many();
$radius_hotspot = ORM::for_table('tbl_plans')->where('enabled', '1')->where('is_radius', 1)->where('type', 'Hotspot')->where('allow_purchase', 'yes')->find_many();
$routers = ORM::for_table('tbl_routers')->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_pppoe = ORM::for_table('tbl_plans')->where('enabled', '1')->where('is_radius', 0)->where('type', 'PPPOE')->where('allow_purchase', 'yes')->find_many();
$plans_hotspot = ORM::for_table('tbl_plans')->where('enabled', '1')->where('is_radius', 0)->where('type', 'Hotspot')->where('allow_purchase', 'yes')->find_many();
}
$ui->assign('routers', $routers);
$ui->assign('radius_pppoe', $radius_pppoe);
@ -277,7 +277,7 @@ switch ($action) {
$router['id'] = 0;
$router['name'] = 'balance';
}
$plan = ORM::for_table('tbl_plans')->where('enabled', '1')->find_one($routes['3']);
$plan = ORM::for_table('tbl_plans')->where('enabled', '1')->where('allow_purchase', 'yes')->find_one($routes['3']);
if (empty($router) || empty($plan)) {
r2(U . "order/package", 'e', Lang::T("Plan Not found"));
}

View File

@ -288,8 +288,14 @@ switch ($action) {
case 'remove-voucher':
$d = ORM::for_table('tbl_voucher')->where_equal('status', '1')->findMany();
if ($d) {
$d->delete();
r2(U . 'prepaid/voucher', 's', $_L['Delete_Successfully']);
$jml = 0;
foreach ($d as $v) {
if(!ORM::for_table('tbl_user_recharges')->where_equal("method",'Voucher - '.$v['code'])->findOne()){
$v->delete();
$jml++;
}
}
r2(U . 'prepaid/voucher', 's', "$jml ".$_L['Delete_Successfully']);
}
case 'print-voucher':
$from_id = _post('from_id');
@ -393,6 +399,8 @@ switch ($action) {
case 'voucher-post':
$type = _post('type');
$plan = _post('plan');
$voucher_format = _post('voucher_format');
$prefix = _post('prefix');
$server = _post('server');
$numbervoucher = _post('numbervoucher');
$lengthcode = _post('lengthcode');
@ -408,19 +416,31 @@ switch ($action) {
$msg .= 'The Length Code must be a number' . '<br>';
}
if ($msg == '') {
if(!empty($prefix)){
$d = ORM::for_table('tbl_appconfig')->where('setting', 'voucher_prefix')->find_one();
if ($d) {
$d->value = $prefix;
$d->save();
} else {
$d = ORM::for_table('tbl_appconfig')->create();
$d->setting = 'voucher_prefix';
$d->value = $prefix;
$d->save();
}
}
run_hook('create_voucher'); #HOOK
for ($i = 0; $i < $numbervoucher; $i++) {
$code = strtoupper(substr(md5(time() . rand(10000, 99999)), 0, $lengthcode));
if ($config['voucher_format'] == 'low') {
if ($voucher_format == 'low') {
$code = strtolower($code);
} else if ($config['voucher_format'] == 'rand') {
} else if ($voucher_format == 'rand') {
$code = Lang::randomUpLowCase($code);
}
$d = ORM::for_table('tbl_voucher')->create();
$d->type = $type;
$d->routers = $server;
$d->id_plan = $plan;
$d->code = $code;
$d->code = $prefix.$code;
$d->user = '0';
$d->status = '0';
$d->save();
@ -457,7 +477,7 @@ switch ($action) {
run_hook('refill_customer'); #HOOK
if ($v1) {
if (Package::rechargeUser($user['id'], $v1['routers'], $v1['id_plan'], "Refill", "Voucher")) {
if (Package::rechargeUser($user['id'], $v1['routers'], $v1['id_plan'], "Voucher", $code)) {
$v1->status = "1";
$v1->user = $user['username'];
$v1->save();

View File

@ -199,6 +199,7 @@ switch ($action) {
$routers = _post('routers');
$pool_expired = _post('pool_expired');
$enabled = _post('enabled');
$allow_purchase = _post('allow_purchase');
$msg = '';
if (Validator::UnsignedNumber($validity) == false) {
@ -264,6 +265,7 @@ switch ($action) {
$d->pool_expired = $pool_expired;
}
$d->enabled = $enabled;
$d->allow_purchase = $allow_purchase;
$d->save();
$plan_id = $d->id();
@ -302,6 +304,7 @@ switch ($action) {
$validity_unit = _post('validity_unit');
$pool_expired = _post('pool_expired');
$enabled = _post('enabled');
$allow_purchase = _post('allow_purchase');
$routers = _post('routers');
$msg = '';
if (Validator::UnsignedNumber($validity) == false) {
@ -363,6 +366,7 @@ switch ($action) {
$d->shared_users = $sharedusers;
$d->pool_expired = $pool_expired;
$d->enabled = $enabled;
$d->allow_purchase = $allow_purchase;
$d->save();
r2(U . 'services/hotspot', 's', $_L['Updated_Successfully']);
@ -456,6 +460,8 @@ switch ($action) {
$pool = _post('pool_name');
$pool_expired = _post('pool_expired');
$enabled = _post('enabled');
$allow_purchase = _post('allow_purchase');
$msg = '';
if (Validator::UnsignedNumber($validity) == false) {
@ -514,6 +520,7 @@ switch ($action) {
$d->pool_expired = $pool_expired;
}
$d->enabled = $enabled;
$d->allow_purchase = $allow_purchase;
$d->save();
$plan_id = $d->id();
@ -545,6 +552,7 @@ switch ($action) {
$pool = _post('pool_name');
$pool_expired = _post('pool_expired');
$enabled = _post('enabled');
$allow_purchase = _post('allow_purchase');
$msg = '';
if (Validator::UnsignedNumber($validity) == false) {
@ -602,6 +610,7 @@ switch ($action) {
$d->pool = $pool;
$d->pool_expired = $pool_expired;
$d->enabled = $enabled;
$d->allow_purchase = $allow_purchase;
$d->save();
r2(U . 'services/pppoe', 's', $_L['Updated_Successfully']);
@ -653,6 +662,7 @@ switch ($action) {
$name = _post('name');
$price = _post('price');
$enabled = _post('enabled');
$allow_purchase = _post('allow_purchase');
$msg = '';
if (Validator::UnsignedNumber($price) == false) {
@ -672,6 +682,7 @@ switch ($action) {
$d->name_plan = $name;
$d->price = $price;
$d->enabled = $enabled;
$d->allow_purchase = $allow_purchase;
$d->save();
r2(U . 'services/balance', 's', $_L['Updated_Successfully']);
@ -683,6 +694,7 @@ switch ($action) {
$name = _post('name');
$price = _post('price');
$enabled = _post('enabled');
$allow_purchase = _post('allow_purchase');
$msg = '';
if (Validator::UnsignedNumber($price) == false) {
@ -708,6 +720,7 @@ switch ($action) {
$d->routers = '';
$d->pool = '';
$d->enabled = $enabled;
$d->allow_purchase = $allow_purchase;
$d->save();
r2(U . 'services/balance', 's', $_L['Created_Successfully']);

View File

@ -11,8 +11,6 @@ $action = $routes['1'];
$user = User::_info();
$ui->assign('_user', $user);
use PEAR2\Net\RouterOS;
require_once 'system/autoload/PEAR2/Autoload.php';
switch ($action) {
@ -27,7 +25,7 @@ switch ($action) {
$v1 = ORM::for_table('tbl_voucher')->where('code', $code)->where('status', 0)->find_one();
run_hook('customer_activate_voucher'); #HOOK
if ($v1) {
if (Package::rechargeUser($user['id'], $v1['routers'], $v1['id_plan'], "Activation", "Voucher")) {
if (Package::rechargeUser($user['id'], $v1['routers'], $v1['id_plan'], "Voucher", $code)) {
$v1->status = "1";
$v1->user = $user['username'];
$v1->save();

View File

@ -417,3 +417,6 @@ $_L['Disable_Registration'] = 'Disable Registration';
$_L['Customer_just_Login_with_Phone_number_and_Voucher_Code_Voucher_will_be_password'] = 'Customer just Login with Phone number and Voucher Code, Voucher will be password';
$_L['Login__Activate_Voucher'] = 'Login / Activate Voucher';
$_L['After_Customer_activate_voucher_or_login_customer_will_be_redirected_to_this_url'] = 'After Customer activate voucher or login, customer will be redirected to this url';
$_L['Voucher_Prefix'] = 'Voucher Prefix';
$_L['Voucher_activation_success_now_you_can_login'] = 'Voucher activation success, now you can login';
$_L['Client_Can_Purchase'] = 'Client Can Purchase';

View File

@ -38,5 +38,8 @@
],
"2023.12.15": [
"ALTER TABLE `tbl_customers` ADD `service_type` ENUM('Hotspot','PPPoE','Others') DEFAULT 'Others' COMMENT 'For selecting user type' AFTER `balance`;"
],
"2024.1.11": [
"ALTER TABLE `tbl_plans` ADD `allow_purchase` ENUM('yes','no') DEFAULT 'yes' COMMENT 'allow to show package in buy package page' AFTER `enabled`;"
]
}

View File

@ -17,6 +17,17 @@
</label>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Client Can Purchase')}</label>
<div class="col-md-10">
<label class="radio-inline warning">
<input type="radio" checked name="allow_purchase" value="yes"> Yes
</label>
<label class="radio-inline">
<input type="radio" name="allow_purchase" value="no"> No
</label>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Plan_Name']}</label>
<div class="col-md-6">

View File

@ -18,6 +18,18 @@
</label>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Client Can Purchase')}</label>
<div class="col-md-10">
<label class="radio-inline warning">
<input type="radio" {if $d['allow_purchase'] == yes}checked{/if} name="allow_purchase" value="yes"> Yes
</label>
<label class="radio-inline">
<input type="radio" {if $d['allow_purchase'] == no}checked{/if} name="allow_purchase" value="no">
No
</label>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Plan_Name']}</label>
<div class="col-md-6">

View File

@ -119,6 +119,7 @@
{/foreach}
</table>
</div>
&nbsp; {$paginator['contents']}
</div>
</div>
@ -149,7 +150,9 @@
$.getJSON("./version.json?" + Math.random(), function(data) {
var localVersion = data.version;
$('#version').html('Version: ' + localVersion);
$.getJSON("https://raw.githubusercontent.com/hotspotbilling/phpnuxbill/master/version.json?" + Math
$.getJSON(
"https://raw.githubusercontent.com/hotspotbilling/phpnuxbill/master/version.json?" +
Math
.random(),
function(data) {
var latestVersion = data.version;

View File

@ -9,12 +9,15 @@
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Status')}</label>
<div class="col-md-10">
<label class="radio-inline warning">
<input type="radio" checked name="enabled" value="1"> Enable
</label>
<label class="radio-inline">
<input type="radio" name="enabled" value="0"> Disable
</label>
<input type="radio" name="enabled" value="1" checked> Enable
<input type="radio" name="enabled" value="0"> Disable
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Client Can Purchase')}</label>
<div class="col-md-10">
<input type="radio" name="allow_purchase" value="yes" checked> Yes
<input type="radio" name="allow_purchase" value="no"> No
</div>
</div>
{if $_c['radius_enable']}
@ -191,4 +194,4 @@
{/literal}
{/if}
{include file="sections/footer.tpl"}
{include file="sections/footer.tpl"}

View File

@ -10,13 +10,15 @@
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Status')}</label>
<div class="col-md-10">
<label class="radio-inline warning">
<input type="radio" {if $d['enabled'] == 1}checked{/if} name="enabled" value="1"> Enable
</label>
<label class="radio-inline">
<input type="radio" {if $d['enabled'] == 0}checked{/if} name="enabled" value="0">
Disable
</label>
<input type="radio" name="enabled" value="1" {if $d['enabled'] == 1}checked{/if}> Enable
<input type="radio" name="enabled" value="0" {if $d['enabled'] == 0}checked{/if}> Disable
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Client Can Purchase')}</label>
<div class="col-md-10">
<input type="radio" name="allow_purchase" value="yes" {if $d['allow_purchase'] == yes}checked{/if}> Yes
<input type="radio" name="allow_purchase" value="no" {if $d['allow_purchase'] == no}checked{/if}> No
</div>
</div>
{if $_c['radius_enable'] and $d['is_radius']}
@ -204,4 +206,4 @@
</script>
{/literal}
{/if}
{include file="sections/footer.tpl"}
{include file="sections/footer.tpl"}

View File

@ -44,7 +44,7 @@
<td>{Lang::dateTimeFormat($ds['date'])}</td>
<td>{$ds['type']}</td>
<td>{$ds['ip']}</td>
<td style="overflow-x: scroll;">{$ds['description']}</td>
<td style="overflow-x: scroll;">{nl2br($ds['description'])}</td>
</tr>
{/foreach}
</tbody>

View File

@ -39,7 +39,7 @@
<div class="box-header">
<h3 class="box-title">{$pg['name']}</h3>
</div>
<div class="box-body">{$pg['description']}<br><small><i>@{$plugin['author']} Last update: {$plugin['last_update']}</i></small></div>
<div class="box-body">{$pg['description']}<br><small><i>@{$pg['author']} Last update: {$pg['last_update']}</i></small></div>
<div class="box-footer ">
<div class="btn-group btn-group-justified" role="group" aria-label="...">
<a href="{$pg['url']}" target="_blank"

View File

@ -9,21 +9,22 @@
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Status')}</label>
<div class="col-md-10">
<label class="radio-inline warning">
<input type="radio" checked name="enabled" value="1"> Enable
</label>
<label class="radio-inline">
<input type="radio" name="enabled" value="0"> Disable
</label>
<input type="radio" checked name="enabled" value="1"> Enable
<input type="radio" name="enabled" value="0"> Disable
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Client Can Purchase')}</label>
<div class="col-md-10">
<input type="radio" checked name="allow_purchase" value="yes"> Yes
<input type="radio" name="allow_purchase" value="no"> No
</div>
</div>
{if $_c['radius_enable']}
<div class="form-group">
<label class="col-md-2 control-label">Radius</label>
<div class="col-md-6">
<label class="radio-inline">
<input type="checkbox" name="radius" onclick="isRadius(this)" value="1"> Radius Plan
</label>
<input type="checkbox" name="radius" onclick="isRadius(this)" value="1"> Radius Plan
</div>
<p class="help-block col-md-4">{Lang::T('Cannot be change after saved')}</p>
</div>
@ -142,4 +143,4 @@
</script>
{/literal}
{/if}
{include file="sections/footer.tpl"}
{include file="sections/footer.tpl"}

View File

@ -10,13 +10,15 @@
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Status')}</label>
<div class="col-md-10">
<label class="radio-inline warning">
<input type="radio" {if $d['enabled'] == 1}checked{/if} name="enabled" value="1"> Enable
</label>
<label class="radio-inline">
<input type="radio" {if $d['enabled'] == 0}checked{/if} name="enabled" value="0">
Disable
</label>
<input type="radio" name="enabled" value="1" {if $d['enabled'] == 1}checked{/if}> Enable
<input type="radio" name="enabled" value="0" {if $d['enabled'] == 0}checked{/if}> Disable
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Client Can Purchase')}</label>
<div class="col-md-10">
<input type="radio" name="allow_purchase" value="yes" {if $d['allow_purchase'] == yes}checked{/if}> Yes
<input type="radio" name="allow_purchase" value="no" {if $d['allow_purchase'] == no}checked{/if}> No
</div>
</div>
{if $_c['radius_enable'] and $d['is_radius']}
@ -137,4 +139,4 @@
</script>
{/literal}
{/if}
{include file="sections/footer.tpl"}
{include file="sections/footer.tpl"}

View File

@ -81,7 +81,7 @@
Hotspot
{elseif $_user.service_type == 'PPPoE'}
PPPoE
{elseif $_user.service_type == 'Other' || $_user.service_type == null}
{elseif $_user.service_type == 'Others' || $_user.service_type == null}
Others
{/if}
</td>

View File

@ -31,21 +31,41 @@
</select>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Number_of_Vouchers']}</label>
<div class="col-md-6">
<input type="text" class="form-control" name="numbervoucher" value="1">
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Voucher Format')}</label>
<div class="col-md-6">
<select name="voucher_format" id="voucher_format" class="form-control">
<option value="up" {if $_c['voucher_format'] == 'up'}selected="selected" {/if}>UPPERCASE
</option>
<option value="low" {if $_c['voucher_format'] == 'low'}selected="selected" {/if}>
lowercase
</option>
<option value="rand" {if $_c['voucher_format'] == 'rand'}selected="selected" {/if}>
RaNdoM
</option>
</select>
</div>
<p class="help-block col-md-4">UPPERCASE lowercase RaNdoM</p>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Voucher Prefix')}</label>
<div class="col-md-6">
<input type="text" class="form-control" name="prefix" placeholder="NUX-" value="{$_c['voucher_prefix']}">
</div>
<p class="help-block col-md-4">NUX-VoUCHeRCOdE</p>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Length_Code']}</label>
<div class="col-md-6">
<input type="text" class="form-control" name="lengthcode" value="12">
</div>
</div>
<div class="form-group">
<div class="col-lg-offset-2 col-lg-10">
<button class="btn btn-success waves-effect waves-light"

View File

@ -1,3 +1,3 @@
{
"version": "2023.12.21"
"version": "2024.1.11"
}