Compare commits

..

8 Commits

Author SHA1 Message Date
127576b03f add default balance in installation 2023-08-19 11:56:01 +07:00
5d4cb4cce0 Merge pull request #65 from hotspotbilling/Development
PPP Comment
2023-08-18 13:39:26 +07:00
4196dbf591 Merge pull request #64 from hotspotbilling/Development
add comment to mikrotik
2023-08-18 10:13:02 +07:00
5f6fc31344 Merge pull request #63 from hotspotbilling/Development
Fix Auto Renewall Cronjob
2023-08-18 09:53:30 +07:00
db03ad3061 Merge pull request #61 from hotspotbilling/Development
From version 2023.8.1 need to click update twice, or click Update Database after update at Community pages
2023-08-16 14:05:19 +07:00
606b4fafcd Merge pull request #57 from hotspotbilling/Development
Add self Update Script
2023-08-01 16:31:03 +07:00
96f92f5e30 Merge pull request #56 from hotspotbilling/Development
- Fix link buy Voucher
- Add email field to registration form
- Change registration design Form
- Add Setting to disable Voucher
- Fix Title for PPPOE plans
- Fix Plugin Cache
2023-07-28 01:44:38 -07:00
2c110db6f9 Version 2023.6.20 - hide package start time
Version 2023.6.20
2023-06-21 09:35:32 +07:00
79 changed files with 3739 additions and 4309 deletions

10
.gitignore vendored
View File

@ -20,9 +20,7 @@ system/plugin/ui/*
ui/ui_custom/**
!ui/ui_custom/index.html
!ui/ui_custom/README.md
system/uploads/**
!system/uploads/*.default.png
system/uploads/sms/**
!system/uploads/sms/index.html
system/uploads/system/**
!system/uploads/system/index.html
system/uploads/admin.png
system/uploads/logo.png
system/uploads/user.jpg
system/uploads/notifications.json

View File

@ -2,45 +2,6 @@
# CHANGELOG
## 2023.9.6
- Expired Pool
Customer can be move to expired pool after plan expired by cron
- Fix Delete customer
- tbl_language removed
## 2023.9.1.1
- Fix cronjob Delete customer
- Fix reminder text
## 2023.9.1
- Critical bug fixes, bug happen when user buy package, expired time will be calculated from last expired, not from when they buy the package
- Time not change after user buy package for extending
- Add Cancel Button to user dashboard when it show unpaid package
- Fix username in user dashboard
## 2023.8.30
- Upload Logo from settings
- Fix Print value
- Fix Time when editing prepaid
## 2023.8.28
- Extend expiration if buy same package
- Fix calendar
- Add recharge time
- Fix allow balance transfer
## 2023.8.24
- Balance transfer between Customer
- Optimize Cronjob
- View Customer Info
- Ajax for select customer
## 2023.8.18
- Fix Auto Renewall Cronjob

View File

@ -16,8 +16,11 @@
<body style='background-color: #FBFBFB;'>
<div id='main-container'>
<img src="img/logo.png" class="img-responsive" alt="Logo" />
<hr>
<div class='header'>
<div class="header-box wrapper">
<div class="hd-logo"><a href="#"><img src="img/logo.png" alt="Logo" /></a></div>
</div>
</div>
<!-- contents area start -->
<div class="row">
<div class="col-md-12">

View File

@ -50,7 +50,7 @@ CREATE TABLE
`id` int(10) NOT NULL,
`username` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`password` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`pppoe_password` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
`pppoe_password` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '1',
`fullname` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`address` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci,
`phonenumber` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0',
@ -65,6 +65,22 @@ CREATE TABLE
--
-- Struktur dari tabel `tbl_language`
--
CREATE TABLE
`tbl_language` (
`id` int(10) NOT NULL,
`name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`folder` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`author` varchar(60) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_general_ci;
-- --------------------------------------------------------
--
-- Struktur dari tabel `tbl_logs`
--
@ -158,7 +174,6 @@ CREATE TABLE
`shared_users` int(10) DEFAULT NULL,
`routers` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`pool` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
`pool_expired` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '',
`enabled` tinyint(1) NOT NULL DEFAULT '1' COMMENT '0 disabled\r\n'
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_general_ci;
@ -213,7 +228,6 @@ CREATE TABLE
`plan_name` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`price` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`recharged_on` date NOT NULL,
`recharged_time` time NOT NULL DEFAULT '00:00:00',
`expiration` date NOT NULL,
`time` time NOT NULL,
`method` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
@ -257,7 +271,6 @@ CREATE TABLE
`plan_id` int(10) NOT NULL,
`namebp` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`recharged_on` date NOT NULL,
`recharged_time` time NOT NULL DEFAULT '00:00:00',
`expiration` date NOT NULL,
`time` time NOT NULL,
`status` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
@ -330,6 +343,14 @@ ALTER TABLE `tbl_customers` ADD PRIMARY KEY (`id`);
--
-- Indeks untuk tabel `tbl_language`
--
ALTER TABLE `tbl_language` ADD PRIMARY KEY (`id`);
--
-- Indeks untuk tabel `tbl_logs`
--
@ -443,6 +464,15 @@ ALTER TABLE
--
-- AUTO_INCREMENT untuk tabel `tbl_language`
--
ALTER TABLE
`tbl_language` MODIFY `id` int(10) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT untuk tabel `tbl_logs`
--
@ -578,4 +608,39 @@ VALUES (
'Active',
'2022-09-06 16:09:50',
'2014-06-23 01:43:07'
);
--
-- Dumping data untuk tabel `tbl_language`
--
INSERT INTO
`tbl_language` (
`id`,
`name`,
`folder`,
`author`
)
VALUES (
1,
'Indonesia',
'indonesia',
'Ismail Marzuqi'
), (
2,
'English',
'english',
'Ismail Marzuqi'
), (
3,
'Spanish',
'spanish',
'Luis Hernandez'
), (
4,
'Türkçe',
'turkish',
'Goktug Bogac Ogel'
);

View File

@ -16,8 +16,11 @@
<body style='background-color: #FBFBFB;'>
<div id='main-container'>
<img src="img/logo.png" class="img-responsive" alt="Logo" />
<hr>
<div class='header'>
<div class="header-box wrapper">
<div class="hd-logo"><a href="#"><img src="img/logo.png" alt="Logo" /></a></div>
</div>
</div>
<div class="span12">
<h4> PHPNuxBill Installer </h4>

View File

@ -15,8 +15,11 @@
<body style='background-color: #FBFBFB;'>
<div id='main-container'>
<img src="img/logo.png" class="img-responsive" alt="Logo" />
<hr>
<div class='header'>
<div class="header-box wrapper">
<div class="hd-logo"><a href="#"><img src="img/logo.png" alt="Logo"/></a></div>
</div>
</div>
<div class="span12">
<h4> PHPNuxBill Installer </h4>

View File

@ -82,8 +82,11 @@ $wConfig = "../config.php";
<body style='background-color: #FBFBFB;'>
<div id='main-container'>
<img src="img/logo.png" class="img-responsive" alt="Logo" />
<hr>
<div class='header'>
<div class="header-box wrapper">
<div class="hd-logo"><a href="#"><img src="img/logo.png" alt="Logo"/></a></div>
</div>
</div>
<div class="span12">
<h4> PHPNuxBill Installer </h4>

View File

@ -1,8 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>PHPNuxBill Installer</title>
<title>PHPNuxBill Installer</title>
<link rel="shortcut icon" type="image/x-icon" href="img/favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
@ -10,46 +9,38 @@
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type='text/css' href='css/style.css' rel='stylesheet' />
<link type='text/css' href='css/style.css' rel='stylesheet'/>
<link type='text/css' href="css/bootstrap.min.css" rel="stylesheet">
</head>
<?php if (!file_exists('../pages')) rename('../pages_template', '../pages'); ?>
<body style='background-color: #FBFBFB;'>
<div id='main-container'>
<img src="img/logo.png" class="img-responsive" alt="Logo" />
<hr>
<div class="span12">
<h4> PHPNuxBill Installer </h4>
<p>
<strong>Congratulations!</strong><br>
You have just install PHPNuxBill !<br><br>
<span class="text-danger">But wait!!<br>
<ol>
<li>Don't forget to rename folder <b>pages_example</b> to <b>pages</b>.<br>
if it not yet renamed</li>
<li>Activate <a href="https://github.com/hotspotbilling/phpnuxbill/wiki/Cron-Jobs" target="_blank">Cronjob</a> for Expired and Reminder.</li>
<li>Check <a href="https://github.com/hotspotbilling/phpnuxbill/wiki/How-It-Works---Cara-kerja" target="_blank">how PHPNuxbill Works</a></li>
<li><a href="https://github.com/hotspotbilling/phpnuxbill/wiki#login-page-mikrotik" target="_blank">how to link Mikrotik Login to PHPNuxBill</a></li>
<li>or use <a href="https://github.com/hotspotbilling/phpnuxbill-mikrotik-login-template" target="_blank">Mikrotik Login Template for PHPNuxBill</a></li>
</ol>
</span><br><br>
To Login Admin Portal:<br>
Use this link -
<?php
$cururl = (((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || $_SERVER['SERVER_PORT'] == 443) ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$appurl = str_replace('/install/step5.php', '', $cururl);
$appurl = str_replace('/system', '', $appurl);
echo '<a href="' . $appurl . '/admin">' . $appurl . '/admin</a>';
?>
<br>
Username: admin<br>
Password: admin<br>
For security, Delete the <b>install</b> directory inside system folder.
</p>
</div>
</div>
<div class="footer">Copyright &copy; 2021 PHPNuxBill. All Rights Reserved<br /><br /></div>
</body>
<div id='main-container'>
<div class='header'>
<div class="header-box wrapper">
<div class="hd-logo"><a href="#"><img src="img/logo.png" alt="Logo"/></a></div>
</div>
</div>
<div class="span12">
<h4> PHPNuxBill Installer </h4>
<p>
<strong>Congratulations!</strong><br>
You have just install PHPNuxBill !<br>
To Login Admin Portal:<br>
Use this link -
<?php
$cururl = (((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off')|| $_SERVER['SERVER_PORT'] == 443)?'https':'http').'://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$appurl = str_replace('/install/step5.php', '', $cururl);
$appurl = str_replace('/system', '', $appurl);
echo '<a href="' . $appurl . '/admin">' . $appurl . '/admin</a>';
?>
<br>
Username: admin<br>
Password: admin<br>
For security, Delete the <b>install</b> directory inside system folder.
</p>
</div>
</div>
<div class="footer">Copyright &copy; 2021 PHPNuxBill. All Rights Reserved<br/><br/></div>
</body>
</html>

View File

@ -16,8 +16,11 @@
<body style='background-color: #FBFBFB;'>
<div id='main-container'>
<img src="img/logo.png" class="img-responsive" alt="Logo" />
<hr>
<div class='header'>
<div class="header-box wrapper">
<div class="hd-logo"><a href="#"><img src="img/logo.png" alt="Logo" /></a></div>
</div>
</div>
<div class="span12">
<h4> PHPNuxBill Updater </h4>

View File

@ -18,11 +18,15 @@ class Balance
public static function transfer($id_customer, $phoneTarget, $amount)
{
global $config;
if (Balance::min($id_customer, $amount)) {
if (Balance::plusByPhone($phoneTarget, $amount)) {
return true;
if ($config['allow_balance_transfer'] == 'yes') {
if (Balance::min($id_customer, $amount)) {
if (Balance::plusByPhone($phoneTarget, $amount)) {
return true;
} else {
Balance::plus($id_customer, $amount);
return false;
}
} else {
Balance::plus($id_customer, $amount);
return false;
}
} else {

View File

@ -33,63 +33,6 @@ class File
rmdir($path);
}
public static function resizeCropImage($source_file, $dst_dir, $max_width, $max_height, $quality = 80)
{
$imgsize = getimagesize($source_file);
$width = $imgsize[0];
$height = $imgsize[1];
$mime = $imgsize['mime'];
switch ($mime) {
case 'image/gif':
$image_create = "imagecreatefromgif";
$image = "imagegif";
break;
case 'image/png':
$image_create = "imagecreatefrompng";
$image = "imagepng";
$quality = 7;
break;
case 'image/jpeg':
$image_create = "imagecreatefromjpeg";
$image = "imagejpeg";
$quality = 80;
break;
default:
return false;
break;
}
if ($max_width == 0) {
$max_width = $width;
}
if ($max_height == 0) {
$max_height = $height;
}
$widthRatio = $max_width / $width;
$heightRatio = $max_height / $height;
$ratio = min($widthRatio, $heightRatio);
$nwidth = (int)$width * $ratio;
$nheight = (int)$height * $ratio;
$dst_img = imagecreatetruecolor($nwidth, $nheight);
$white = imagecolorallocate($dst_img, 255, 255, 255);
imagefill($dst_img, 0, 0, $white);
$src_img = $image_create($source_file);
imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $nwidth, $nheight, $width, $height);
$image($dst_img, $dst_dir, $quality);
if ($dst_img) imagedestroy($dst_img);
if ($src_img) imagedestroy($src_img);
return file_exists($dst_dir);
}
/**
* file path fixer

View File

@ -31,40 +31,4 @@ class Lang
return $phone;
}
}
public static function dateFormat($date){
global $config;
return date($config['date_format'], strtotime($date));
}
public static function dateTimeFormat($date){
global $config;
if(strtotime($date) < strtotime("2000-01-01 00:00:00")){
return "";
}else{
return date($config['date_format']. ' H:i', strtotime($date));
}
}
public static function dateAndTimeFormat($date, $time){
global $config;
return date($config['date_format']. ' H:i', strtotime("$date $time"));
}
public static function nl2br($text){
return nl2br($text);
}
public static function arrayCount($arr){
return count($arr);
}
public static function getNotifText($key){
global $_notifmsg, $_notifmsg_default;
if(isset($_notifmsg[$key])){
return $_notifmsg[$key];
}else{
return $_notifmsg_default[$key];
}
}
}

View File

@ -56,20 +56,4 @@ class Message
return "$via: $msg";
}
public static function sendBalanceNotification($phone, $name, $balance, $message, $via)
{
$msg = str_replace('[[name]]', "*$name*", $message);
$msg = str_replace('[[balance]]', "*" . Lang::moneyFormat($balance) . "*", $msg);
if (
!empty($phone) && strlen($phone) > 5
&& !empty($message) && in_array($via, ['sms', 'wa'])
) {
if ($via == 'sms') {
Message::sendSMS($phone, $msg);
} else if ($via == 'wa') {
Message::sendWhatsapp($phone, $msg);
}
}
return "$via: $msg";
}
}

View File

@ -12,14 +12,11 @@ class Mikrotik
public static function getClient($ip, $user, $pass)
{
global $ui;
try {
$iport = explode(":", $ip);
return new RouterOS\Client($iport[0], $user, $pass, ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
$ui->assign("error_meesage", "Unable to connect to the router.<br>" . $e->getMessage());
$ui->display('router-error.tpl');
die();
die("Unable to connect to the router.<br>" . $e->getMessage());
}
}
@ -72,77 +69,46 @@ class Mikrotik
public static function setHotspotPlan($client, $name, $sharedusers, $rate)
{
$printRequest = new RouterOS\Request(
'/ip hotspot user profile print .proplist=.id',
'/ip hotspot user profile print .proplist=name',
RouterOS\Query::where('name', $name)
);
$profileID = $client->sendSync($printRequest)->getProperty('.id');
if (empty($profileID)) {
Mikrotik::addHotspotPlan($client, $name, $sharedusers, $rate);
}else{
$setRequest = new RouterOS\Request('/ip/hotspot/user/profile/set');
$client(
$setRequest
->setArgument('numbers', $profileID)
->setArgument('shared-users', $sharedusers)
->setArgument('rate-limit', $rate)
);
}
}
$profileName = $client->sendSync($printRequest)->getProperty('name');
public static function setHotspotExpiredPlan($client, $name, $pool)
{
$printRequest = new RouterOS\Request(
'/ip hotspot user profile print .proplist=.id',
RouterOS\Query::where('name', $name)
$setRequest = new RouterOS\Request('/ip/hotspot/user/profile/set');
$client(
$setRequest
->setArgument('numbers', $profileName)
->setArgument('shared-users', $sharedusers)
->setArgument('rate-limit', $rate)
);
$profileID = $client->sendSync($printRequest)->getProperty('.id');
if (empty($profileID)) {
$addRequest = new RouterOS\Request('/ip/hotspot/user/profile/add');
$client->sendSync(
$addRequest
->setArgument('name', $name)
->setArgument('shared-users', 3)
->setArgument('address-pool', $pool)
->setArgument('rate-limit', '512K/512K')
);
}else{
$setRequest = new RouterOS\Request('/ip/hotspot/user/profile/set');
$client(
$setRequest
->setArgument('numbers', $profileID)
->setArgument('shared-users', 3)
->setArgument('address-pool', $pool)
->setArgument('rate-limit', '512K/512K')
);
}
}
public static function removeHotspotPlan($client, $name)
{
$printRequest = new RouterOS\Request(
'/ip hotspot user profile print .proplist=.id',
'/ip hotspot user profile print .proplist=name',
RouterOS\Query::where('name', $name)
);
$profileID = $client->sendSync($printRequest)->getProperty('.id');
$profileName = $client->sendSync($printRequest)->getProperty('name');
$removeRequest = new RouterOS\Request('/ip/hotspot/user/profile/remove');
$client(
$removeRequest
->setArgument('numbers', $profileID)
->setArgument('numbers', $profileName)
);
}
public static function removeHotspotUser($client, $username)
{
$printRequest = new RouterOS\Request(
'/ip hotspot user print .proplist=.id',
'/ip hotspot user print .proplist=name',
RouterOS\Query::where('name', $username)
);
$userID = $client->sendSync($printRequest)->getProperty('.id');
$userName = $client->sendSync($printRequest)->getProperty('name');
$removeRequest = new RouterOS\Request('/ip/hotspot/user/remove');
$client(
$removeRequest
->setArgument('numbers', $userID)
->setArgument('numbers', $userName)
);
}
@ -210,7 +176,7 @@ class Mikrotik
}
}
public static function setHotspotUser($client, $user, $pass)
public static function setHotspotUser($client, $user, $pass, $nuser = null)
{
$printRequest = new RouterOS\Request('/ip/hotspot/user/print');
$printRequest->setArgument('.proplist', '.id');
@ -223,19 +189,6 @@ class Mikrotik
$client->sendSync($setRequest);
}
public static function setHotspotUserPackage($client, $user, $plan)
{
$printRequest = new RouterOS\Request('/ip/hotspot/user/print');
$printRequest->setArgument('.proplist', '.id');
$printRequest->setQuery(RouterOS\Query::where('name', $user));
$id = $client->sendSync($printRequest)->getProperty('.id');
$setRequest = new RouterOS\Request('/ip/hotspot/user/set');
$setRequest->setArgument('numbers', $id);
$setRequest->setArgument('profile', $plan);
$client->sendSync($setRequest);
}
public static function removeHotspotActiveUser($client, $username)
{
$onlineRequest = new RouterOS\Request('/ip/hotspot/active/print');
@ -248,14 +201,27 @@ class Mikrotik
$client->sendSync($removeRequest);
}
public static function removePpoeUser($client, $username)
public static function setHotspotLimitUptime($client, $username)
{
$printRequest = new RouterOS\Request('/ppp/secret/print');
$printRequest = new RouterOS\Request('/ip/hotspot/user/print');
$printRequest->setArgument('.proplist', '.id');
$printRequest->setQuery(RouterOS\Query::where('name', $username));
$id = $client->sendSync($printRequest)->getProperty('.id');
$setRequest = new RouterOS\Request('/ip/hotspot/user/set');
$setRequest->setArgument('numbers', $id);
$setRequest->setArgument('limit-uptime', '00:00:05');
$client->sendSync($setRequest);
}
public static function removePpoeUser($client, $username)
{
$printRequest = new RouterOS\Request(
'/ppp secret print .proplist=name',
RouterOS\Query::where('name', $username)
);
$id = $client->sendSync($printRequest)->getProperty('.id');
$removeRequest = new RouterOS\Request('/ppp/secret/remove');
$client(
$removeRequest
@ -281,7 +247,7 @@ class Mikrotik
);
}
public static function setPpoeUser($client, $user, $pass)
public static function setPpoeUser($client, $user, $pass, $nuser = null)
{
$printRequest = new RouterOS\Request('/ppp/secret/print');
$printRequest->setArgument('.proplist', '.id');
@ -294,16 +260,15 @@ class Mikrotik
$client->sendSync($setRequest);
}
public static function setPpoeUserPlan($client, $user, $plan)
public static function disablePpoeUser($client, $username)
{
$printRequest = new RouterOS\Request('/ppp/secret/print');
$printRequest->setArgument('.proplist', '.id');
$printRequest->setQuery(RouterOS\Query::where('name', $user));
$printRequest->setQuery(RouterOS\Query::where('name', $username));
$id = $client->sendSync($printRequest)->getProperty('.id');
$setRequest = new RouterOS\Request('/ppp/secret/set');
$setRequest = new RouterOS\Request('/ppp/secret/disable');
$setRequest->setArgument('numbers', $id);
$setRequest->setArgument('profile', $plan);
$client->sendSync($setRequest);
}
@ -322,15 +287,15 @@ class Mikrotik
public static function removePool($client, $name)
{
$printRequest = new RouterOS\Request(
'/ip pool print .proplist=.id',
'/ip pool print .proplist=name',
RouterOS\Query::where('name', $name)
);
$poolID = $client->sendSync($printRequest)->getProperty('.id');
$poolName = $client->sendSync($printRequest)->getProperty('name');
$removeRequest = new RouterOS\Request('/ip/pool/remove');
$client(
$removeRequest
->setArgument('numbers', $poolID)
->setArgument('numbers', $poolName)
);
}
@ -347,18 +312,18 @@ class Mikrotik
public static function setPool($client, $name, $ip_address)
{
$printRequest = new RouterOS\Request(
'/ip pool print .proplist=.id',
'/ip pool print .proplist=name',
RouterOS\Query::where('name', $name)
);
$poolID = $client->sendSync($printRequest)->getProperty('id');
$poolName = $client->sendSync($printRequest)->getProperty('name');
if (empty($poolID)) {
if (empty($poolName)) {
self::addPool($client, $name, $ip_address);
} else {
$setRequest = new RouterOS\Request('/ip/pool/set');
$client(
$setRequest
->setArgument('numbers', $poolID)
->setArgument('numbers', $poolName)
->setArgument('ranges', $ip_address)
);
}
@ -380,17 +345,17 @@ class Mikrotik
public static function setPpoePlan($client, $name, $pool, $rate)
{
$printRequest = new RouterOS\Request(
'/ppp profile print .proplist=.id',
'/ppp profile print .proplist=name',
RouterOS\Query::where('name', $name)
);
$profileID = $client->sendSync($printRequest)->getProperty('.id');
if (empty($profileID)) {
$profileName = $client->sendSync($printRequest)->getProperty('name');
if (empty($profileName)) {
self::addPpoePlan($client, $name, $pool, $rate);
} else {
$setRequest = new RouterOS\Request('/ppp/profile/set');
$client(
$setRequest
->setArgument('numbers', $profileID)
->setArgument('numbers', $profileName)
->setArgument('local-address', $pool)
->setArgument('remote-address', $pool)
->setArgument('rate-limit', $rate)
@ -401,15 +366,15 @@ class Mikrotik
public static function removePpoePlan($client, $name)
{
$printRequest = new RouterOS\Request(
'/ppp profile print .proplist=.id',
'/ppp profile print .proplist=name',
RouterOS\Query::where('name', $name)
);
$profileID = $client->sendSync($printRequest)->getProperty('.id');
$profileName = $client->sendSync($printRequest)->getProperty('name');
$removeRequest = new RouterOS\Request('/ppp/profile/remove');
$client(
$removeRequest
->setArgument('numbers', $profileID)
->setArgument('numbers', $profileName)
);
}
}

View File

@ -19,10 +19,9 @@ class Package
*/
public static function rechargeUser($id_customer, $router_name, $plan_id, $gateway, $channel)
{
global $_c;
global $_c, $_L, $_notifmsg;
$date_now = date("Y-m-d H:i:s");
$date_only = date("Y-m-d");
$time_only = date("H:i:s");
$time = date("H:i:s");
if ($id_customer == '' or $router_name == '' or $plan_id == '') {
@ -41,7 +40,6 @@ class Package
$t->plan_name = $p['name_plan'];
$t->price = $p['price'];
$t->recharged_on = $date_only;
$t->recharged_time = date("H:i:s");
$t->expiration = $date_only;
$t->time = $time;
$t->method = "$gateway - $channel";
@ -51,7 +49,7 @@ class Package
Balance::plus($id_customer, $p['price']);
$textInvoice = Lang::getNotifText('invoice_balance');
$textInvoice = $_notifmsg['invoice_balance'];
$textInvoice = str_replace('[[company_name]]', $_c['CompanyName'], $textInvoice);
$textInvoice = str_replace('[[address]]', $_c['address'], $textInvoice);
$textInvoice = str_replace('[[phone]]', $_c['phone'], $textInvoice);
@ -98,35 +96,14 @@ class Package
if (!$_c['radius_mode']) {
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
Mikrotik::removeHotspotUser($client, $c['username']);
Mikrotik::removePpoeUser($client, $c['username']);
Mikrotik::addHotspotUser($client, $p, $c);
}
if ($b['namebp'] == $p['name_plan'] && $b['status'] == 'on') {
// if it same internet plan, expired will extend
if ($p['validity_unit'] == 'Months') {
$date_exp = date("Y-m-d", strtotime($b['expiration'] . ' +' . $p['validity'] . ' months'));
$time = $b['time'];
} else if ($p['validity_unit'] == 'Days') {
$date_exp = date("Y-m-d", strtotime($b['expiration'] . ' +' . $p['validity'] . ' days'));
$time = $b['time'];
} else if ($p['validity_unit'] == 'Hrs') {
$datetime = explode(' ', date("Y-m-d H:i:s", strtotime($b['expiration'] . ' ' . $b['time'] . ' +' . $p['validity'] . ' hours')));
$date_exp = $datetime[0];
$time = $datetime[1];
} else if ($p['validity_unit'] == 'Mins') {
$datetime = explode(' ', date("Y-m-d H:i:s", strtotime($b['expiration'] . ' ' . $b['time'] . ' +' . $p['validity'] . ' minutes')));
$date_exp = $datetime[0];
$time = $datetime[1];
}
}
$b->customer_id = $id_customer;
$b->username = $c['username'];
$b->plan_id = $plan_id;
$b->namebp = $p['name_plan'];
$b->recharged_on = $date_only;
$b->recharged_time = $time_only;
$b->expiration = $date_exp;
$b->time = $time;
$b->status = "on";
@ -142,7 +119,6 @@ class Package
$t->plan_name = $p['name_plan'];
$t->price = $p['price'];
$t->recharged_on = $date_only;
$t->recharged_time = $time_only;
$t->expiration = $date_exp;
$t->time = $time;
$t->method = "$gateway - $channel";
@ -152,8 +128,6 @@ class Package
} else {
if (!$_c['radius_mode']) {
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
Mikrotik::removeHotspotUser($client, $c['username']);
Mikrotik::removePpoeUser($client, $c['username']);
Mikrotik::addHotspotUser($client, $p, $c);
}
@ -163,7 +137,6 @@ class Package
$d->plan_id = $plan_id;
$d->namebp = $p['name_plan'];
$d->recharged_on = $date_only;
$d->recharged_time = $time_only;
$d->expiration = $date_exp;
$d->time = $time;
$d->status = "on";
@ -179,7 +152,6 @@ class Package
$t->plan_name = $p['name_plan'];
$t->price = $p['price'];
$t->recharged_on = $date_only;
$t->recharged_time = $time_only;
$t->expiration = $date_exp;
$t->time = $time;
$t->method = "$gateway - $channel";
@ -191,43 +163,21 @@ class Package
"\nRouter: " . $router_name .
"\nGateway: " . $gateway .
"\nChannel: " . $channel .
"\nPrice: " . Lang::moneyFormat($p['price']));
"\nPrice: " . $p['price']);
} else {
if ($b) {
if (!$_c['radius_mode']) {
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
Mikrotik::removeHotspotUser($client, $c['username']);
Mikrotik::removePpoeUser($client, $c['username']);
Mikrotik::addPpoeUser($client, $p, $c);
}
if ($b['namebp'] == $p['name_plan'] && $b['status'] == 'on') {
// if it same internet plan, expired will extend
if ($p['validity_unit'] == 'Months') {
$date_exp = date("Y-m-d", strtotime($b['expiration'] . ' +' . $p['validity'] . ' months'));
$time = $b['time'];
} else if ($p['validity_unit'] == 'Days') {
$date_exp = date("Y-m-d", strtotime($b['expiration'] . ' +' . $p['validity'] . ' days'));
$time = $b['time'];
} else if ($p['validity_unit'] == 'Hrs') {
$datetime = explode(' ', date("Y-m-d H:i:s", strtotime($b['expiration'] . ' ' . $b['time'] . ' +' . $p['validity'] . ' hours')));
$date_exp = $datetime[0];
$time = $datetime[1];
} else if ($p['validity_unit'] == 'Mins') {
$datetime = explode(' ', date("Y-m-d H:i:s", strtotime($b['expiration'] . ' ' . $b['time'] . ' +' . $p['validity'] . ' minutes')));
$date_exp = $datetime[0];
$time = $datetime[1];
}
}
$b->customer_id = $id_customer;
$b->username = $c['username'];
$b->plan_id = $plan_id;
$b->namebp = $p['name_plan'];
$b->recharged_on = $date_only;
$b->recharged_time = $time_only;
$b->expiration = $date_exp;
$b->time = $time;
$b->status = "on";
@ -243,7 +193,6 @@ class Package
$t->plan_name = $p['name_plan'];
$t->price = $p['price'];
$t->recharged_on = $date_only;
$t->recharged_time = $time_only;
$t->expiration = $date_exp;
$t->time = $time;
$t->method = "$gateway - $channel";
@ -253,8 +202,6 @@ class Package
} else {
if (!$_c['radius_mode']) {
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
Mikrotik::removeHotspotUser($client, $c['username']);
Mikrotik::removePpoeUser($client, $c['username']);
Mikrotik::addPpoeUser($client, $p, $c);
}
@ -264,7 +211,6 @@ class Package
$d->plan_id = $plan_id;
$d->namebp = $p['name_plan'];
$d->recharged_on = $date_only;
$d->recharged_time = $time_only;
$d->expiration = $date_exp;
$d->time = $time;
$d->status = "on";
@ -280,7 +226,6 @@ class Package
$t->plan_name = $p['name_plan'];
$t->price = $p['price'];
$t->recharged_on = $date_only;
$t->recharged_time = $time_only;
$t->expiration = $date_exp;
$t->time = $time;
$t->method = "$gateway - $channel";
@ -292,12 +237,12 @@ class Package
"\nRouter: " . $router_name .
"\nGateway: " . $gateway .
"\nChannel: " . $channel .
"\nPrice: " . Lang::moneyFormat($p['price']));
"\nPrice: " . $p['price']);
}
$in = ORM::for_table('tbl_transactions')->where('username', $c['username'])->order_by_desc('id')->find_one();
$textInvoice = Lang::getNotifText('invoice_paid');
$textInvoice = $_notifmsg['invoice_paid'];
$textInvoice = str_replace('[[company_name]]', $_c['CompanyName'], $textInvoice);
$textInvoice = str_replace('[[address]]', $_c['address'], $textInvoice);
$textInvoice = str_replace('[[phone]]', $_c['phone'], $textInvoice);
@ -333,14 +278,11 @@ class Package
if (!$_c['radius_mode']) {
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
Mikrotik::removeHotspotUser($client, $c['username']);
Mikrotik::removePpoeUser($client, $c['username']);
Mikrotik::addHotspotUser($client, $p, $c);
}
} else {
if (!$_c['radius_mode']) {
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
Mikrotik::removeHotspotUser($client, $c['username']);
Mikrotik::removePpoeUser($client, $c['username']);
Mikrotik::addHotspotUser($client, $p, $c);
}
}
@ -348,15 +290,12 @@ class Package
if ($b) {
if (!$_c['radius_mode']) {
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
Mikrotik::removeHotspotUser($client, $c['username']);
Mikrotik::removePpoeUser($client, $c['username']);
Mikrotik::addPpoeUser($client, $p, $c);
}
} else {
if (!$_c['radius_mode']) {
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
Mikrotik::removeHotspotUser($client, $c['username']);
Mikrotik::removePpoeUser($client, $c['username']);
Mikrotik::addPpoeUser($client, $p, $c);
}
}

View File

@ -1,29 +1,28 @@
<?php
/**
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
**/
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
**/
class Paginator
Class Paginator
{
public static function bootstrap($table, $w1 = '', $c1 = '', $w2 = '', $c2 = '', $w3 = '', $c3 = '', $w4 = '', $c4 = '', $per_page = '10')
public static function bootstrap($table, $w1='',$c1='', $w2='', $c2= '', $w3='',$c3='', $w4='', $c4= '', $per_page = '10')
{
global $routes;
global $routes;
global $_L;
$url = U . $routes['0'] . '/' . $routes['1'] . '/';
$url = U.$routes['0'].'/'.$routes['1'].'/';
$adjacents = "2";
$page = (int)(!isset($routes['2']) ? 1 : $routes['2']);
$pagination = "";
if ($w1 != '') {
$totalReq = ORM::for_table($table)->where($w1, $c1)->count();
} elseif ($w2 != '') {
$totalReq = ORM::for_table($table)->where($w1, $c1)->where($w2, $c2)->count();
} elseif ($w3 != '') {
$totalReq = ORM::for_table($table)->where($w1, $c1)->where($w2, $c2)->where($w3, $c3)->count();
} elseif ($w4 != '') {
$totalReq = ORM::for_table($table)->where($w1, $c1)->where($w2, $c2)->where($w3, $c3)->where($w4, $c4)->count();
} else {
if($w1 != ''){
$totalReq = ORM::for_table($table)->where($w1,$c1)->count();
}elseif($w2 != ''){
$totalReq = ORM::for_table($table)->where($w1,$c1)->where($w2,$c2)->count();
}elseif($w3 != ''){
$totalReq = ORM::for_table($table)->where($w1,$c1)->where($w2,$c2)->where($w3,$c3)->count();
}elseif($w4 != ''){
$totalReq = ORM::for_table($table)->where($w1,$c1)->where($w2,$c2)->where($w3,$c3)->where($w4,$c4)->count();
}else{
$totalReq = ORM::for_table($table)->count();
}
@ -86,103 +85,16 @@ class Paginator
}
if ($page < $counter - 1) {
$pagination .= "<li><a href='{$url}$next'>" . $_L['Next'] . "</a></li>";
$pagination .= "<li><a href='{$url}$lastpage'>" . $_L['Last'] . "</a></li>";
$pagination .= "<li><a href='{$url}$next'>".$_L['Next']."</a></li>";
$pagination .= "<li><a href='{$url}$lastpage'>".$_L['Last']."</a></li>";
} else {
$pagination .= "<li class='disabled'><a class='disabled'>" . $_L['Next'] . "</a></li>";
$pagination .= "<li class='disabled'><a class='disabled'>" . $_L['Last'] . "</a></li>";
$pagination .= "<li class='disabled'><a class='disabled'>".$_L['Next']."</a></li>";
$pagination .= "<li class='disabled'><a class='disabled'>".$_L['Last']."</a></li>";
}
$pagination .= "</ul>";
$gen = array("startpoint" => $startpoint, "limit" => $limit, "found" => $totalReq, "page" => $page, "lastpage" => $lastpage, "contents" => $pagination);
return $gen;
}
}
public static function bootstrapRaw($table, $w1 = '', $c1 = [], $per_page = '10')
{
global $routes;
global $_L;
$url = U . $routes['0'] . '/' . $routes['1'] . '/';
$adjacents = "2";
$page = (int)(!isset($routes['2']) ? 1 : $routes['2']);
$pagination = "";
if ($w1 != '') {
$totalReq = ORM::for_table($table)->where_raw($w1, $c1)->count();
} else {
$totalReq = ORM::for_table($table)->count();
}
$i = 0;
$page = ($page == 0 ? 1 : $page);
$start = ($page - 1) * $per_page;
$prev = $page - 1;
$next = $page + 1;
$lastpage = ceil($totalReq / $per_page);
$lpm1 = $lastpage - 1;
$limit = $per_page;
$startpoint = ($page * $limit) - $limit;
if ($lastpage >= 1) {
$pagination .= '<ul class="pagination pagination-sm">';
if ($lastpage < 7 + ($adjacents * 2)) {
for ($counter = 1; $counter <= $lastpage; $counter++) {
if ($counter == $page)
$pagination .= "<li class='active'><a href='javascript:void(0);'>$counter</a></li>";
else
$pagination .= "<li><a href='{$url}$counter'>$counter</a></li>";
}
} elseif ($lastpage > 5 + ($adjacents * 2)) {
if ($page < 1 + ($adjacents * 2)) {
for ($counter = 1; $counter < 4 + ($adjacents * 2); $counter++) {
if ($counter == $page)
$pagination .= "<li class='active'><a href='javascript:void(0);'>$counter</a></li>";
else
$pagination .= "<li><a href='{$url}$counter'>$counter</a></li>";
}
$pagination .= "<li class='disabled'><a href='#'>...</a></li>";
$pagination .= "<li><a href='{$url}$lpm1'>$lpm1</a></li>";
$pagination .= "<li><a href='{$url}$lastpage'>$lastpage</a></li>";
} elseif ($lastpage - ($adjacents * 2) > $page && $page > ($adjacents * 2)) {
$pagination .= "<li><a href='{$url}1'>1</a></li>";
$pagination .= "<li><a href='{$url}2'>2</a></li>";
$pagination .= "<li class='disabled'><a href='#'>...</a></li>";
for ($counter = $page - $adjacents; $counter <= $page + $adjacents; $counter++) {
if ($counter == $page)
$pagination .= "<li class='active'><a href='javascript:void(0);'>$counter</a></li>";
else
$pagination .= "<li><a href='{$url}$counter'>$counter</a></li>";
}
$pagination .= "<li class='disabled'><a href='#'>...</a></li>";
$pagination .= "<li><a href='{$url}$lpm1'>$lpm1</a></li>";
$pagination .= "<li><a href='{$url}$lastpage'>$lastpage</a></li>";
} else {
$pagination .= "<li><a href='{$url}1'>1</a></li>";
$pagination .= "<li><a href='{$url}2'>2</a></li>";
$pagination .= "<li><a href='#'>...</a></li>";
for ($counter = $lastpage - (2 + ($adjacents * 2)); $counter <= $lastpage; $counter++) {
if ($counter == $page)
$pagination .= "<li class='active'><a class='disabled'>$counter</a></li>";
else
$pagination .= "<li><a href='{$url}$counter'>$counter</a></li>";
}
}
}
if ($page < $counter - 1) {
$pagination .= "<li><a href='{$url}$next'>" . $_L['Next'] . "</a></li>";
$pagination .= "<li><a href='{$url}$lastpage'>" . $_L['Last'] . "</a></li>";
} else {
$pagination .= "<li class='disabled'><a class='disabled'>" . $_L['Next'] . "</a></li>";
$pagination .= "<li class='disabled'><a class='disabled'>" . $_L['Last'] . "</a></li>";
}
$pagination .= "</ul>";
$gen = array("startpoint" => $startpoint, "limit" => $limit, "found" => $totalReq, "page" => $page, "lastpage" => $lastpage, "contents" => $pagination);
return $gen;
}
}
}
}

View File

@ -4,33 +4,6 @@
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
**/
// on some server, it getting error because of slash is backwards
function _autoloader($class)
{
if (strpos($class, '_') !== false) {
$class = str_replace('_', DIRECTORY_SEPARATOR, $class);
if (file_exists('autoload' . DIRECTORY_SEPARATOR . $class . '.php')) {
include 'autoload' . DIRECTORY_SEPARATOR . $class . '.php';
} else {
$class = str_replace("\\", DIRECTORY_SEPARATOR, $class);
if (file_exists(__DIR__ . DIRECTORY_SEPARATOR . 'autoload' . DIRECTORY_SEPARATOR . $class . '.php'))
include __DIR__ . DIRECTORY_SEPARATOR . 'autoload' . DIRECTORY_SEPARATOR . $class . '.php';
}
} else {
if (file_exists('autoload' . DIRECTORY_SEPARATOR . $class . '.php')) {
include 'autoload' . DIRECTORY_SEPARATOR . $class . '.php';
} else {
$class = str_replace("\\", DIRECTORY_SEPARATOR, $class);
if (file_exists(__DIR__ . DIRECTORY_SEPARATOR . 'autoload' . DIRECTORY_SEPARATOR . $class . '.php'))
include __DIR__ . DIRECTORY_SEPARATOR . 'autoload' . DIRECTORY_SEPARATOR . $class . '.php';
}
}
}
spl_autoload_register('_autoloader');
function r2($to, $ntype = 'e', $msg = '')
{
if ($msg == '') {
@ -74,7 +47,8 @@ function _get($param, $defvalue = '')
}
}
require_once File::pathFixer('system/orm.php');
require('system/orm.php');
ORM::configure("mysql:host=$db_host;dbname=$db_name");
ORM::configure('username', $db_user);
@ -107,15 +81,15 @@ function _notify($msg, $type = 'e')
$_SESSION['notify'] = $msg;
}
$lan_file = File::pathFixer('system/lan/' . $config['language'] . '/common.lan.php');
$lan_file = 'system/lan/' . $config['language'] . '/common.lan.php';
require($lan_file);
$ui = new Smarty();
$ui->setTemplateDir(['custom' => File::pathFixer('ui/ui_custom/'), 'default' => File::pathFixer('ui/ui/')]);
$ui->addTemplateDir(File::pathFixer('system/paymentgateway/ui/'), 'pg');
$ui->addTemplateDir(File::pathFixer('system/plugin/ui/'), 'plugin');
$ui->setCompileDir(File::pathFixer('ui/compiled/'));
$ui->setConfigDir(File::pathFixer('ui/conf/'));
$ui->setCacheDir(File::pathFixer('ui/cache/'));
$ui->setTemplateDir(['custom' => 'ui/ui_custom/', 'default' => 'ui/ui/']);
$ui->addTemplateDir('system/paymentgateway/ui/', 'pg');
$ui->addTemplateDir('system/plugin/ui/', 'plugin');
$ui->setCompileDir('ui/compiled/');
$ui->setConfigDir('ui/conf/');
$ui->setCacheDir('ui/cache/');
$ui->assign('app_url', APP_URL);
$ui->assign('_domain', str_replace('www.', '', parse_url(APP_URL, PHP_URL_HOST)));
define('U', APP_URL . '/index.php?_route=');
@ -155,16 +129,41 @@ if (isset($_SESSION['notify'])) {
include "autoload/Hookers.php";
// notification message
if (file_exists(File::pathFixer("system/uploads/notifications.json"))) {
$_notifmsg = json_decode(file_get_contents(File::pathFixer('system/uploads/notifications.json')), true);
if(file_exists("system/uploads/notifications.json")){
$_notifmsg =json_decode(file_get_contents('system/uploads/notifications.json'), true);
}else{
$_notifmsg = json_decode(file_get_contents('system/uploads/notifications.default.json'), true);
}
$_notifmsg_default = json_decode(file_get_contents(File::pathFixer('system/uploads/notifications.default.json')), true);
//register all plugin
foreach (glob(File::pathFixer("system/plugin/*.php")) as $filename) {
foreach (glob("system/plugin/*.php") as $filename) {
include $filename;
}
// on some server, it getting error because of slash is backwards
function _autoloader($class)
{
if (strpos($class, '_') !== false) {
$class = str_replace('_', DIRECTORY_SEPARATOR, $class);
if (file_exists('autoload' . DIRECTORY_SEPARATOR . $class . '.php')) {
include 'autoload' . DIRECTORY_SEPARATOR . $class . '.php';
} else {
$class = str_replace("\\", DIRECTORY_SEPARATOR, $class);
if (file_exists(__DIR__ . DIRECTORY_SEPARATOR . 'autoload' . DIRECTORY_SEPARATOR . $class . '.php'))
include __DIR__ . DIRECTORY_SEPARATOR . 'autoload' . DIRECTORY_SEPARATOR . $class . '.php';
}
} else {
if (file_exists('autoload' . DIRECTORY_SEPARATOR . $class . '.php')) {
include 'autoload' . DIRECTORY_SEPARATOR . $class . '.php';
} else {
$class = str_replace("\\", DIRECTORY_SEPARATOR, $class);
if (file_exists(__DIR__ . DIRECTORY_SEPARATOR . 'autoload' . DIRECTORY_SEPARATOR . $class . '.php'))
include __DIR__ . DIRECTORY_SEPARATOR . 'autoload' . DIRECTORY_SEPARATOR . $class . '.php';
}
}
}
spl_autoload_register('_autoloader');
function _auth($login = true)
{
@ -283,7 +282,7 @@ $handler = $routes[0];
if ($handler == '') {
$handler = 'default';
}
$sys_render = File::pathFixer('system/controllers/' . $handler . '.php');
$sys_render = 'system/controllers/' . $handler . '.php';
if (file_exists($sys_render)) {
$menus = array();
// "name" => $name,

View File

@ -1,9 +1,8 @@
<?php
/**
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
* used for ajax
**/
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
* used for ajax
**/
_admin();
$ui->assign('_title', $_L['Network']);
@ -15,45 +14,28 @@ $ui->assign('_admin', $admin);
switch ($action) {
case 'pool':
$routers = _get('routers');
$d = ORM::for_table('tbl_pool')->where('routers', $routers)->find_many();
$ui->assign('d', $d);
$routers = _get('routers');
$d = ORM::for_table('tbl_pool')->where('routers', $routers)->find_many();
$ui->assign('d',$d);
$ui->display('autoload-pool.tpl');
break;
case 'server':
$d = ORM::for_table('tbl_routers')->where('enabled', '1')->find_many();
$ui->assign('d', $d);
$d = ORM::for_table('tbl_routers')->where('enabled', '1')->find_many();
$ui->assign('d',$d);
$ui->display('autoload-server.tpl');
break;
case 'plan':
$server = _post('server');
$jenis = _post('jenis');
$d = ORM::for_table('tbl_plans')->where('routers', $server)->where('type', $jenis)->where('enabled', '1')->find_many();
$ui->assign('d', $d);
$server = _post('server');
$jenis = _post('jenis');
$d = ORM::for_table('tbl_plans')->where('routers', $server)->where('type', $jenis)->where('enabled', '1')->find_many();
$ui->assign('d',$d);
$ui->display('autoload.tpl');
break;
case 'customer_select2':
$s = addslashes(_get('s'));
if (empty($s)) {
$c = ORM::for_table('tbl_customers')->limit(30)->find_many();
} else {
$c = ORM::for_table('tbl_customers')->where_raw("(`username` LIKE '%$s%' OR `fullname` LIKE '%$s%' OR `phonenumber` LIKE '%$s%' OR `email` LIKE '%$s%')", [$s, $s, $s, $s])->limit(30)->find_many();
}
header('Content-Type: application/json');
foreach ($c as $cust) {
$json[] = [
'id' => $cust['id'],
'text' => $cust['username'] . ' - ' . $cust['fullname'] . ' - ' . $cust['email']
];
}
echo json_encode(['results' => $json]);
die();
break;
default:
echo 'action not defined';
}
}

View File

@ -24,20 +24,25 @@ switch ($action) {
case 'list':
$ui->assign('xfooter', '<script type="text/javascript" src="ui/lib/c/customers.js"></script>');
$search = _post('search');
$what = _post('what');
if(!in_array($what,['username','fullname','phonenumber','email'])){
$what = 'username';
}
run_hook('list_customers'); #HOOK
if ($search != '') {
$paginator = Paginator::bootstrapRaw('tbl_customers', "(`username` LIKE '%$search%' OR `fullname` LIKE '%$search%' OR `phonenumber` LIKE '%$search%' OR `email` LIKE '%$search%')", [$search, $search, $search, $search]);
$paginator = Paginator::bootstrap('tbl_customers', 'username', '%' . $search . '%');
$d = ORM::for_table('tbl_customers')
->where_raw("(`username` LIKE '%$search%' OR `fullname` LIKE '%$search%' OR `phonenumber` LIKE '%$search%' OR `email` LIKE '%$search%')", [$search, $search, $search, $search])
->offset($paginator['startpoint'])
->limit($paginator['limit'])
->order_by_desc('id')->find_many();
->where_like($what, '%' . $search . '%')
->offset($paginator['startpoint'])
->limit($paginator['limit'])
->order_by_desc('id')->find_many();
} else {
$paginator = Paginator::bootstrap('tbl_customers');
$d = ORM::for_table('tbl_customers')->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_desc('id')->find_many();
}
$ui->assign('search', htmlspecialchars($search));
$ui->assign('what', $what);
$ui->assign('d', $d);
$ui->assign('paginator', $paginator);
$ui->display('customers.tpl');
@ -48,48 +53,6 @@ switch ($action) {
$ui->display('customers-add.tpl');
break;
case 'viewu':
$customer = ORM::for_table('tbl_customers')->where('username', $routes['2'])->find_one();
case 'view':
$id = $routes['2'];
run_hook('view_customer'); #HOOK
if(!$customer){
$customer = ORM::for_table('tbl_customers')->find_one($id);
}
if ($customer) {
$v = $routes['3'];
if (empty($v) || $v == 'order') {
$v = 'order';
// $paginator = Paginator::bootstrap('tbl_payment_gateway', 'username', $customer['username']);
// print_r($paginator);
$order = ORM::for_table('tbl_payment_gateway')
->where('username', $customer['username'])
->offset(0)
->limit(30)
->order_by_desc('id')
->find_many();
// $ui->assign('paginator', $paginator);
$ui->assign('order', $order);
} else if ($v == 'activation') {
// $paginator = Paginator::bootstrap('tbl_transactions', 'username', $customer['username']);
$activation = ORM::for_table('tbl_transactions')
->where('username', $customer['username'])
->offset(0)
->limit(30)
->order_by_desc('id')
->find_many();
// $ui->assign('paginator', $paginator);
$ui->assign('activation', $activation);
}
$package = ORM::for_table('tbl_user_recharges')->where('username',$customer['username'])->find_one();
$ui->assign('package', $package);
$ui->assign('v', $v);
$ui->assign('d', $customer);
$ui->display('customers-view.tpl');
} else {
r2(U . 'customers/list', 'e', $_L['Account_Not_Found']);
}
break;
case 'edit':
$id = $routes['2'];
run_hook('edit_customer'); #HOOK
@ -111,22 +74,22 @@ switch ($action) {
if ($c) {
$mikrotik = Mikrotik::info($c['routers']);
if ($c['type'] == 'Hotspot') {
if (!$config['radius_mode']) {
if(!$config['radius_mode']){
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
Mikrotik::removeHotspotUser($client, $c['username']);
Mikrotik::removeHotspotActiveUser($client, $c['username']);
Mikrotik::removeHotspotUser($client,$c['username']);
Mikrotik::removeHotspotActiveUser($client,$user['username']);
}
} else {
if (!$config['radius_mode']) {
if(!$config['radius_mode']){
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
Mikrotik::removePpoeUser($client, $c['username']);
Mikrotik::removePpoeActive($client, $c['username']);
Mikrotik::removePpoeUser($client,$c['username']);
Mikrotik::removePpoeActive($client,$user['username']);
}
}
try {
$d->delete();
} catch (Exception $e) {
} catch (Throwable $e) {
} catch(Throwable $e){
}
try {
$c->delete();
@ -136,12 +99,12 @@ switch ($action) {
try {
$d->delete();
} catch (Exception $e) {
} catch (Throwable $e) {
} catch(Throwable $e){
}
try {
$c->delete();
} catch (Exception $e) {
} catch (Throwable $e) {
} catch(Throwable $e){
}
}
@ -230,23 +193,23 @@ switch ($action) {
if ($c) {
$mikrotik = Mikrotik::info($c['routers']);
if ($c['type'] == 'Hotspot') {
if (!$config['radius_mode']) {
if(!$config['radius_mode']){
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
Mikrotik::setHotspotUser($client, $c['username'], $password);
Mikrotik::removeHotspotActiveUser($client, $user['username']);
Mikrotik::setHotspotUser($client,$c['username'],$password);
Mikrotik::removeHotspotActiveUser($client,$user['username']);
}
$d->password = $password;
$d->save();
} else {
if (!$config['radius_mode']) {
if(!$config['radius_mode']){
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
if (!empty($d['pppoe_password'])) {
if(!empty($d['pppoe_password'])){
Mikrotik::setPpoeUser($client, $c['username'], $d['pppoe_password']);
} else {
}else{
Mikrotik::setPpoeUser($client, $c['username'], $password);
}
Mikrotik::removePpoeActive($client, $user['username']);
Mikrotik::removePpoeActive($client,$user['username']);
}
$d->password = $password;
@ -281,5 +244,5 @@ switch ($action) {
break;
default:
r2(U . 'customers/list', 'e', 'action not defined');
r2(U . 'customers/list', 'e', 'action not defined');
}

View File

@ -9,72 +9,11 @@ $ui->assign('_title', $_L['Dashboard']);
$user = User::_info();
$ui->assign('_user', $user);
if (isset($_GET['renewal'])) {
if(isset($_GET['renewal'])){
$user->auto_renewal = $_GET['renewal'];
$user->save();
}
if (_post('send') == 'balance') {
if ($config['enable_balance'] == 'yes' && $config['allow_balance_transfer'] == 'yes') {
$target = ORM::for_table('tbl_customers')->where('username', _post('username'))->find_one();
if (!$target) {
r2(U . 'home', 'd', Lang::T('Username not found'));
}
$username = _post('username');
$balance = _post('balance');
if ($user['balance'] < $balance) {
r2(U . 'home', 'd', Lang::T('insufficient balance'));
}
if (!empty($config['minimum_transfer']) && intval($balance) <= intval($config['minimum_transfer'])) {
r2(U . 'home', 'd', Lang::T('Minimum Transfer') . ' ' . Lang::moneyFormat($config['minimum_transfer']));
}
if ($user['username'] == $target['username']) {
r2(U . 'home', 'd', Lang::T('Cannot send to yourself'));
}
if (Balance::transfer($user['id'], $username, $balance)) {
//sender
$d = ORM::for_table('tbl_payment_gateway')->create();
$d->username = $user['username'];
$d->gateway = $target['username'];
$d->plan_id = 0;
$d->plan_name = 'Send Balance';
$d->routers_id = 0;
$d->routers = 'balance';
$d->price = $balance;
$d->payment_method = "Customer";
$d->payment_channel = "Balance";
$d->created_date = date('Y-m-d H:i:s');
$d->paid_date = date('Y-m-d H:i:s');
$d->expired_date = date('Y-m-d H:i:s');
$d->pg_url_payment = 'balance';
$d->status = 2;
$d->save();
//receiver
$d = ORM::for_table('tbl_payment_gateway')->create();
$d->username = $target['username'];
$d->gateway = $user['username'];
$d->plan_id = 0;
$d->plan_name = 'Receive Balance';
$d->routers_id = 0;
$d->routers = 'balance';
$d->payment_method = "Customer";
$d->payment_channel = "Balance";
$d->price = $balance;
$d->created_date = date('Y-m-d H:i:s');
$d->paid_date = date('Y-m-d H:i:s');
$d->expired_date = date('Y-m-d H:i:s');
$d->pg_url_payment = 'balance';
$d->status = 2;
$d->save();
Message::sendBalanceNotification($user['phonenumber'], $target['fullname'] . ' (' . $target['username'] . ')', $balance, Lang::getNotifText('balance_send'), $config['user_notification_payment']);
Message::sendBalanceNotification($target['phonenumber'], $user['fullname'] . ' (' . $user['username'] . ')', $balance, Lang::getNotifText('balance_received'), $config['user_notification_payment']);
Message::sendTelegram("#u$user[username] send balance to #u$target[username] \n" . Lang::moneyFormat($balance));
r2(U . 'home', 's', Lang::T('Sending balance success'));
}
} else {
r2(U . 'home', 'd', 'Failed, balance is not available');
}
}
//Client Page
$bill = User::_billing();
@ -88,7 +27,7 @@ if (!empty($_SESSION['nux-mac']) && !empty($_SESSION['nux-ip'])) {
$c = Mikrotik::getClient($m['ip_address'], $m['username'], $m['password']);
Mikrotik::logMeIn($c, $user['username'], $user['password'], $_SESSION['nux-ip'], $_SESSION['nux-mac']);
r2(U . 'home', 's', Lang::T('Login Request successfully'));
} else if ($_GET['mikrotik'] == 'logout') {
}else if ($_GET['mikrotik'] == 'logout') {
$m = Mikrotik::info($bill['routers']);
$c = Mikrotik::getClient($m['ip_address'], $m['username'], $m['password']);
Mikrotik::logMeOut($c, $user['username']);

View File

@ -17,12 +17,11 @@ switch ($action) {
break;
case 'history':
$ui->assign('_system_menu', 'history');
$paginator = Paginator::bootstrap('tbl_payment_gateway', 'username', $user['username']);
$d = ORM::for_table('tbl_payment_gateway')
->where('username', $user['username'])
->order_by_desc('id')
->offset($paginator['startpoint'])->limit($paginator['limit'])
->find_many();
$paginator = Paginator::bootstrap('tbl_payment_gateway', 'username', $user['username']);
$ui->assign('paginator', $paginator);
$ui->assign('d', $d);
$ui->assign('_title', Lang::T('Order History'));
@ -63,7 +62,7 @@ switch ($action) {
}
break;
case 'view':
$trxid = $routes['2'];
$trxid = $routes['2'] * 1;
$trx = ORM::for_table('tbl_payment_gateway')
->where('username', $user['username'])
->find_one($trxid);
@ -98,7 +97,7 @@ switch ($action) {
}
}
if (empty($trx)) {
r2(U . "order", 'e', Lang::T("Transaction Not found"));
r2(U . "home", 'e', Lang::T("Transaction Not found"));
}
$router = ORM::for_table('tbl_routers')->find_one($trx['routers_id']);
$plan = ORM::for_table('tbl_plans')->find_one($trx['plan_id']);
@ -110,30 +109,6 @@ switch ($action) {
$ui->assign('_title', 'TRX #' . $trxid);
$ui->display('user-orderView.tpl');
break;
case 'pay':
if ($_c['enable_balance'] != 'yes'){
r2(U . "order", 'e', Lang::T("Balance not enabled"));
}
$plan = ORM::for_table('tbl_plans')->where('enabled', '1')->find_one($routes['3']);
$router = ORM::for_table('tbl_routers')->where('enabled', '1')->find_one($routes['2']);
if (empty($router) || empty($plan)) {
r2(U . "order/package", 'e', Lang::T("Plan Not found"));
}
if ($plan && $plan['enabled'] && $user['balance'] >= $plan['price']) {
if (Package::rechargeUser($user['id'], $plan['routers'], $plan['id'], 'Customer', 'Balance')) {
// if success, then get the balance
Balance::min($user['id'], $plan['price']);
r2(U . "home", 's', Lang::T("Success to buy package"));
} else {
r2(U . "order/package", 'e', Lang::T("Failed to buy package"));
Message::sendTelegram("Buy Package with Balance Failed\n\n#u$c[username] #buy \n" . $plan['name_plan'] .
"\nRouter: " . $router_name .
"\nPrice: " . $p['price']);
}
}else{
echo "no renewall | plan enabled: $p[enabled] | User balance: $c[balance] | price $p[price]\n";
}
break;
case 'buy':
if (strpos($user['email'], '@') === false) {
r2(U . 'accounts/profile', 'e', Lang::T("Please enter your email address"));

View File

@ -15,6 +15,9 @@ if ($admin['user_type'] != 'Admin') {
r2(U . "dashboard", 'e', $_L['Do_Not_Access']);
}
use PEAR2\Net\RouterOS;
require_once 'system/autoload/PEAR2/Autoload.php';
switch ($action) {
case 'list':
@ -142,5 +145,5 @@ switch ($action) {
break;
default:
r2(U . 'pool/list/', 's', '');
echo 'action not defined';
}

View File

@ -18,24 +18,7 @@ if ($admin['user_type'] != 'Admin' and $admin['user_type'] != 'Sales') {
r2(U . "dashboard", 'e', $_L['Do_Not_Access']);
}
$select2_customer = <<<EOT
<script>
document.addEventListener("DOMContentLoaded", function(event) {
$('#personSelect').select2({
theme: "bootstrap",
ajax: {
url: function(params) {
if(params.term != undefined){
return './index.php?_route=autoload/customer_select2&s='+params.term;
}else{
return './index.php?_route=autoload/customer_select2';
}
}
}
});
});
</script>
EOT;
use PEAR2\Net\RouterOS;
require_once 'system/autoload/PEAR2/Autoload.php';
@ -60,7 +43,8 @@ switch ($action) {
break;
case 'recharge':
$ui->assign('xfooter', $select2_customer);
$c = ORM::for_table('tbl_customers')->find_many();
$ui->assign('c', $c);
$p = ORM::for_table('tbl_plans')->where('enabled', '1')->find_many();
$ui->assign('p', $p);
$r = ORM::for_table('tbl_routers')->where('enabled', '1')->find_many();
@ -97,14 +81,14 @@ switch ($action) {
}
if ($msg == '') {
if (Package::rechargeUser($id_customer, $server, $plan, "Recharge", $admin['fullname'])) {
if(Package::rechargeUser($id_customer, $server, $plan, "Recharge", $admin['fullname'])){
$c = ORM::for_table('tbl_customers')->where('id', $id_customer)->find_one();
$in = ORM::for_table('tbl_transactions')->where('username', $c['username'])->order_by_desc('id')->find_one();
$ui->assign('in', $in);
$ui->assign('date', date("Y-m-d H:i:s"));
$ui->display('invoice.tpl');
_log('[' . $admin['username'] . ']: ' . 'Recharge ' . $c['username'] . ' [' . $in['plan_name'] . '][' . Lang::moneyFormat($in['price']) . ']', 'Admin', $admin['id']);
} else {
_log('[' . $admin['username'] . ']: ' . 'Recharge '.$c['username'].' ['.$in['plan_name'].']['.Lang::moneyFormat($in['price']).']', 'Admin', $admin['id']);
}else{
r2(U . 'prepaid/recharge', 'e', "Failed to recharge account");
}
} else {
@ -114,6 +98,7 @@ switch ($action) {
case 'print':
$id = _post('id');
$d = ORM::for_table('tbl_transactions')->where('id', $id)->find_one();
$ui->assign('d', $d);
@ -144,20 +129,20 @@ switch ($action) {
if ($d) {
run_hook('delete_customer_active_plan'); #HOOK
if ($d['type'] == 'Hotspot') {
if (!$config['radius_mode']) {
if(!$config['radius_mode']){
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
Mikrotik::removeHotspotUser($client, $c['username']);
Mikrotik::removeHotspotUser($client,$c['username']);
}
$d->delete();
} else {
if (!$config['radius_mode']) {
if(!$config['radius_mode']){
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
Mikrotik::removePpoeUser($client, $c['username']);
Mikrotik::removePpoeUser($client,$c['username']);
}
$d->delete();
}
_log('[' . $admin['username'] . ']: ' . 'Delete Plan for Customer ' . $c['username'] . ' [' . $in['plan_name'] . '][' . Lang::moneyFormat($in['price']) . ']', 'Admin', $admin['id']);
_log('[' . $admin['username'] . ']: ' . 'Delete Plan for Customer '.$c['username'].' ['.$in['plan_name'].']['.Lang::moneyFormat($in['price']).']', 'Admin', $admin['id']);
r2(U . 'prepaid/list', 's', $_L['Delete_Successfully']);
}
break;
@ -167,7 +152,6 @@ switch ($action) {
$id_plan = _post('id_plan');
$recharged_on = _post('recharged_on');
$expiration = _post('expiration');
$time = _post('time');
$id = _post('id');
$d = ORM::for_table('tbl_user_recharges')->find_one($id);
@ -180,12 +164,11 @@ switch ($action) {
run_hook('edit_customer_plan'); #HOOK
$d->username = $username;
$d->plan_id = $id_plan;
//$d->recharged_on = $recharged_on;
$d->recharged_on = $recharged_on;
$d->expiration = $expiration;
$d->time = $time;
$d->save();
Package::changeTo($username, $id_plan);
_log('[' . $admin['username'] . ']: ' . 'Edit Plan for Customer ' . $d['username'] . ' to [' . $d['plan_name'] . '][' . Lang::moneyFormat($d['price']) . ']', 'Admin', $admin['id']);
Package::changeTo($username,$id_plan);
_log('[' . $admin['username'] . ']: ' . 'Edit Plan for Customer '.$d['username'].' to ['.$d['plan_name'].']['.Lang::moneyFormat($d['price']).']', 'Admin', $admin['id']);
r2(U . 'prepaid/list', 's', $_L['Updated_Successfully']);
} else {
r2(U . 'prepaid/edit/' . $id, 'e', $msg);
@ -358,29 +341,33 @@ switch ($action) {
break;
case 'refill':
$ui->assign('xfooter', $select2_customer);
$ui->assign('xfooter', '<script type="text/javascript" src="ui/ui/scripts/form-elements.init.js"></script>');
$ui->assign('_title', $_L['Refill_Account']);
$c = ORM::for_table('tbl_customers')->find_many();
$ui->assign('c', $c);
run_hook('view_refill'); #HOOK
$ui->display('refill.tpl');
break;
case 'refill-post':
$user = _post('id_customer');
$code = _post('code');
$user = ORM::for_table('tbl_customers')->where('id', _post('id_customer'))->find_one();
$v1 = ORM::for_table('tbl_voucher')->where('code', $code)->where('status', 0)->find_one();
run_hook('refill_customer'); #HOOK
if ($v1) {
if (Package::rechargeUser($user['id'], $v1['routers'], $v1['id_plan'], "Refill", "Voucher")) {
if(Package::rechargeUser($user, $v1['routers'], $v1['id_plan'], "Refill", "Voucher")){
$v1->status = "1";
$v1->user = $user['username'];
$v1->user = $c['username'];
$v1->save();
$in = ORM::for_table('tbl_transactions')->where('username', $user['username'])->order_by_desc('id')->find_one();
$c = ORM::for_table('tbl_customers')->where('id', $id_customer)->find_one();
$in = ORM::for_table('tbl_transactions')->where('username', $c['username'])->order_by_desc('id')->find_one();
$ui->assign('in', $in);
$ui->assign('date', date("Y-m-d H:i:s"));
$ui->display('invoice.tpl');
} else {
}else{
r2(U . 'prepaid/refill', 'e', "Failed to refill account");
}
} else {
@ -389,7 +376,7 @@ switch ($action) {
break;
case 'deposit':
$ui->assign('_title', Lang::T('Refill Balance'));
$ui->assign('xfooter', $select2_customer);
$ui->assign('c', ORM::for_table('tbl_customers')->find_many());
$ui->assign('p', ORM::for_table('tbl_plans')->where('enabled', '1')->where('type', 'Balance')->find_many());
run_hook('view_deposit'); #HOOK
$ui->display('deposit.tpl');
@ -400,13 +387,13 @@ switch ($action) {
run_hook('deposit_customer'); #HOOK
if (!empty($user) && !empty($plan)) {
if (Package::rechargeUser($user, 'balance', $plan, "Deposit", $admin['fullname'])) {
if(Package::rechargeUser($user, 'balance', $plan, "Deposit", $admin['fullname'])){
$c = ORM::for_table('tbl_customers')->where('id', $user)->find_one();
$in = ORM::for_table('tbl_transactions')->where('username', $c['username'])->order_by_desc('id')->find_one();
$ui->assign('in', $in);
$ui->assign('date', date("Y-m-d H:i:s"));
$ui->display('invoice.tpl');
} else {
}else{
r2(U . 'prepaid/refill', 'e', "Failed to refill account");
}
} else {

View File

@ -187,5 +187,5 @@ switch ($action) {
break;
default:
r2(U . 'routers/list/', 's', '');
echo 'action not defined';
}

View File

@ -53,10 +53,10 @@ switch ($action) {
$d = ORM::for_table('tbl_plans')->find_one($id);
if ($d) {
$ui->assign('d', $d);
$p = ORM::for_table('tbl_pool')->where('routers', $d['routers'])->find_many();
$ui->assign('p', $p);
$b = ORM::for_table('tbl_bandwidth')->find_many();
$ui->assign('b', $b);
$r = ORM::for_table('tbl_routers')->find_many();
$ui->assign('r', $r);
run_hook('view_edit_plan'); #HOOK
$ui->display('hotspot-edit.tpl');
} else {
@ -96,7 +96,6 @@ switch ($action) {
$validity = _post('validity');
$validity_unit = _post('validity_unit');
$routers = _post('routers');
$pool_expired = _post('pool_expired');
$enabled = _post('enabled');
$msg = '';
@ -135,12 +134,8 @@ switch ($action) {
$mikrotik = Mikrotik::info($routers);
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
Mikrotik::addHotspotPlan($client, $name, $sharedusers, $rate);
if(!empty($pool_expired)){
Mikrotik::setHotspotExpiredPlan($client, 'EXPIRED NUXBILL '.$pool_expired, $pool_expired);
}
}
$d = ORM::for_table('tbl_plans')->create();
$d->name_plan = $name;
$d->id_bw = $id_bw;
@ -156,7 +151,6 @@ switch ($action) {
$d->validity_unit = $validity_unit;
$d->shared_users = $sharedusers;
$d->routers = $routers;
$d->pool_expired = $pool_expired;
$d->enabled = $enabled;
$d->save();
@ -182,7 +176,6 @@ switch ($action) {
$validity = _post('validity');
$validity_unit = _post('validity_unit');
$routers = _post('routers');
$pool_expired = _post('pool_expired');
$enabled = _post('enabled');
$msg = '';
@ -220,9 +213,6 @@ switch ($action) {
$mikrotik = Mikrotik::info($routers);
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
Mikrotik::setHotspotPlan($client, $name, $sharedusers, $rate);
if(!empty($pool_expired)){
Mikrotik::setHotspotExpiredPlan($client, 'EXPIRED NUXBILL '.$pool_expired, $pool_expired);
}
}
$d->name_plan = $name;
@ -238,7 +228,6 @@ switch ($action) {
$d->validity_unit = $validity_unit;
$d->shared_users = $sharedusers;
$d->routers = $routers;
$d->pool_expired = $pool_expired;
$d->enabled = $enabled;
$d->save();
@ -271,6 +260,8 @@ switch ($action) {
$ui->assign('_title', $_L['PPPOE_Plans']);
$d = ORM::for_table('tbl_bandwidth')->find_many();
$ui->assign('d', $d);
$p = ORM::for_table('tbl_pool')->find_many();
$ui->assign('p', $p);
$r = ORM::for_table('tbl_routers')->find_many();
$ui->assign('r', $r);
run_hook('view_add_ppoe'); #HOOK
@ -283,10 +274,10 @@ switch ($action) {
$d = ORM::for_table('tbl_plans')->find_one($id);
if ($d) {
$ui->assign('d', $d);
$p = ORM::for_table('tbl_pool')->where('routers', $d['routers'])->find_many();
$ui->assign('p', $p);
$b = ORM::for_table('tbl_bandwidth')->find_many();
$ui->assign('b', $b);
$p = ORM::for_table('tbl_pool')->find_many();
$ui->assign('p', $p);
$r = ORM::for_table('tbl_routers')->find_many();
$ui->assign('r', $r);
run_hook('view_edit_ppoe'); #HOOK
@ -321,7 +312,6 @@ switch ($action) {
$validity_unit = _post('validity_unit');
$routers = _post('routers');
$pool = _post('pool_name');
$pool_expired = _post('pool_expired');
$enabled = _post('enabled');
$msg = '';
@ -358,9 +348,6 @@ switch ($action) {
$mikrotik = Mikrotik::info($routers);
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
Mikrotik::addPpoePlan($client, $name, $pool, $rate);
if(!empty($pool_expired)){
Mikrotik::setPpoePlan($client, 'EXPIRED NUXBILL '.$pool_expired, $pool_expired, '512K/512K');
}
}
$d = ORM::for_table('tbl_plans')->create();
@ -372,7 +359,6 @@ switch ($action) {
$d->validity_unit = $validity_unit;
$d->routers = $routers;
$d->pool = $pool;
$d->pool_expired = $pool_expired;
$d->enabled = $enabled;
$d->save();
@ -391,7 +377,6 @@ switch ($action) {
$validity_unit = _post('validity_unit');
$routers = _post('routers');
$pool = _post('pool_name');
$pool_expired = _post('pool_expired');
$enabled = _post('enabled');
$msg = '';
@ -429,9 +414,6 @@ switch ($action) {
$mikrotik = Mikrotik::info($routers);
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
Mikrotik::setPpoePlan($client, $name, $pool, $rate);
if(!empty($pool_expired)){
Mikrotik::setPpoePlan($client, 'EXPIRED NUXBILL '.$pool_expired, $pool_expired, '512K/512K');
}
}
$d->name_plan = $name;
@ -441,7 +423,6 @@ switch ($action) {
$d->validity_unit = $validity_unit;
$d->routers = $routers;
$d->pool = $pool;
$d->pool_expired = $pool_expired;
$d->enabled = $enabled;
$d->save();

View File

@ -17,12 +17,6 @@ switch ($action) {
if ($admin['user_type'] != 'Admin') {
r2(U . "dashboard", 'e', $_L['Do_Not_Access']);
}
if (file_exists('system/uploads/logo.png')) {
$logo = 'system/uploads/logo.png?' . time();
} else {
$logo = 'system/uploads/logo.default.png';
}
$ui->assign('logo', $logo);
run_hook('view_app_settings'); #HOOK
$ui->display('app-settings.tpl');
break;
@ -31,14 +25,8 @@ switch ($action) {
if ($admin['user_type'] != 'Admin') {
r2(U . "dashboard", 'e', $_L['Do_Not_Access']);
}
$folders = [];
$files = scandir('system/lan/');
foreach ($files as $file) {
if(is_dir('system/lan/'.$file) && !in_array($file,['.','..'])){
$folders[] = $file;
}
}
$ui->assign('lan', $folders);
$lan = ORM::for_table('tbl_language')->find_many();
$ui->assign('lan', $lan);
$timezonelist = Timezone::timezoneList();
$ui->assign('tlist', $timezonelist);
@ -225,21 +213,13 @@ switch ($action) {
$telegram_target_id = _post('telegram_target_id');
$sms_url = _post('sms_url');
$wa_url = _post('wa_url');
$minimum_transfer = _post('minimum_transfer');
$user_notification_expired = _post('user_notification_expired');
$user_notification_reminder = _post('user_notification_reminder');
$user_notification_payment = _post('user_notification_payment');
$address = _post('address');
$tawkto = _post('tawkto');
$radius_mode = _post('radius_mode') * 1;
$radius_mode = _post('radius_mode')*1;
run_hook('save_settings'); #HOOK
if (!empty($_FILES['logo']['name'])) {
if (file_exists('system/uploads/logo.png')) unlink('system/uploads/logo.png');
File::resizeCropImage($_FILES['logo']['tmp_name'], 'system/uploads/logo.png', 1078, 200, 100);
if (file_exists($_FILES['logo']['tmp_name'])) unlink($_FILES['logo']['tmp_name']);
}
if ($company == '') {
r2(U . 'settings/app', 'e', $_L['All_field_is_required']);
} else {
@ -258,10 +238,10 @@ switch ($action) {
$d = ORM::for_table('tbl_appconfig')->where('setting', 'CompanyFooter')->find_one();
if ($d) {
if($d){
$d->value = $footer;
$d->save();
} else {
}else{
$d = ORM::for_table('tbl_appconfig')->create();
$d->setting = 'CompanyFooter';
$d->value = $footer;
@ -269,10 +249,10 @@ switch ($action) {
}
$d = ORM::for_table('tbl_appconfig')->where('setting', 'disable_voucher')->find_one();
if ($d) {
if($d){
$d->value = $disable_voucher;
$d->save();
} else {
}else{
$d = ORM::for_table('tbl_appconfig')->create();
$d->setting = 'disable_voucher';
$d->value = $disable_voucher;
@ -280,10 +260,10 @@ switch ($action) {
}
$d = ORM::for_table('tbl_appconfig')->where('setting', 'enable_balance')->find_one();
if ($d) {
if($d){
$d->value = $enable_balance;
$d->save();
} else {
}else{
$d = ORM::for_table('tbl_appconfig')->create();
$d->setting = 'enable_balance';
$d->value = $enable_balance;
@ -291,32 +271,21 @@ switch ($action) {
}
$d = ORM::for_table('tbl_appconfig')->where('setting', 'allow_balance_transfer')->find_one();
if ($d) {
if($d){
$d->value = $allow_balance_transfer;
$d->save();
} else {
}else{
$d = ORM::for_table('tbl_appconfig')->create();
$d->setting = 'allow_balance_transfer';
$d->value = $allow_balance_transfer;
$d->save();
}
$d = ORM::for_table('tbl_appconfig')->where('setting', 'minimum_transfer')->find_one();
if ($d) {
$d->value = $minimum_transfer;
$d->save();
} else {
$d = ORM::for_table('tbl_appconfig')->create();
$d->setting = 'minimum_transfer';
$d->value = $minimum_transfer;
$d->save();
}
$d = ORM::for_table('tbl_appconfig')->where('setting', 'telegram_bot')->find_one();
if ($d) {
if($d){
$d->value = $telegram_bot;
$d->save();
} else {
}else{
$d = ORM::for_table('tbl_appconfig')->create();
$d->setting = 'telegram_bot';
$d->value = $telegram_bot;
@ -324,10 +293,10 @@ switch ($action) {
}
$d = ORM::for_table('tbl_appconfig')->where('setting', 'telegram_target_id')->find_one();
if ($d) {
if($d){
$d->value = $telegram_target_id;
$d->save();
} else {
}else{
$d = ORM::for_table('tbl_appconfig')->create();
$d->setting = 'telegram_target_id';
$d->value = $telegram_target_id;
@ -335,10 +304,10 @@ switch ($action) {
}
$d = ORM::for_table('tbl_appconfig')->where('setting', 'sms_url')->find_one();
if ($d) {
if($d){
$d->value = $sms_url;
$d->save();
} else {
}else{
$d = ORM::for_table('tbl_appconfig')->create();
$d->setting = 'sms_url';
$d->value = $sms_url;
@ -346,10 +315,10 @@ switch ($action) {
}
$d = ORM::for_table('tbl_appconfig')->where('setting', 'wa_url')->find_one();
if ($d) {
if($d){
$d->value = $wa_url;
$d->save();
} else {
}else{
$d = ORM::for_table('tbl_appconfig')->create();
$d->setting = 'wa_url';
$d->value = $wa_url;
@ -357,10 +326,10 @@ switch ($action) {
}
$d = ORM::for_table('tbl_appconfig')->where('setting', 'user_notification_expired')->find_one();
if ($d) {
if($d){
$d->value = $user_notification_expired;
$d->save();
} else {
}else{
$d = ORM::for_table('tbl_appconfig')->create();
$d->setting = 'user_notification_expired';
$d->value = $user_notification_expired;
@ -368,10 +337,10 @@ switch ($action) {
}
$d = ORM::for_table('tbl_appconfig')->where('setting', 'user_notification_reminder')->find_one();
if ($d) {
if($d){
$d->value = $user_notification_reminder;
$d->save();
} else {
}else{
$d = ORM::for_table('tbl_appconfig')->create();
$d->setting = 'user_notification_reminder';
$d->value = $user_notification_reminder;
@ -379,10 +348,10 @@ switch ($action) {
}
$d = ORM::for_table('tbl_appconfig')->where('setting', 'user_notification_payment')->find_one();
if ($d) {
if($d){
$d->value = $user_notification_payment;
$d->save();
} else {
}else{
$d = ORM::for_table('tbl_appconfig')->create();
$d->setting = 'user_notification_payment';
$d->value = $user_notification_payment;
@ -390,10 +359,10 @@ switch ($action) {
}
$d = ORM::for_table('tbl_appconfig')->where('setting', 'tawkto')->find_one();
if ($d) {
if($d){
$d->value = $tawkto;
$d->save();
} else {
}else{
$d = ORM::for_table('tbl_appconfig')->create();
$d->setting = 'tawkto';
$d->value = $tawkto;
@ -401,10 +370,10 @@ switch ($action) {
}
$d = ORM::for_table('tbl_appconfig')->where('setting', 'radius_mode')->find_one();
if ($d) {
if($d){
$d->value = $radius_mode;
$d->save();
} else {
}else{
$d = ORM::for_table('tbl_appconfig')->create();
$d->setting = 'radius_mode';
$d->value = $radius_mode;
@ -455,10 +424,10 @@ switch ($action) {
$d = ORM::for_table('tbl_appconfig')->where('setting', 'country_code_phone')->find_one();
if ($d) {
if($d){
$d->value = $country_code_phone;
$d->save();
} else {
}else{
$d = ORM::for_table('tbl_appconfig')->create();
$d->setting = 'country_code_phone';
$d->value = $country_code_phone;
@ -528,12 +497,11 @@ switch ($action) {
r2(U . "dashboard", 'e', $_L['Do_Not_Access']);
}
run_hook('view_notifications'); #HOOK
if (file_exists("system/uploads/notifications.json")) {
if(file_exists("system/uploads/notifications.json")){
$ui->assign('_json', json_decode(file_get_contents('system/uploads/notifications.json'), true));
} else {
}else{
$ui->assign('_json', json_decode(file_get_contents('system/uploads/notifications.default.json'), true));
}
$ui->assign('_default', json_decode(file_get_contents('system/uploads/notifications.default.json'), true));
$ui->display('app-notifications.tpl');
break;
case 'notifications-post':

View File

@ -26,16 +26,187 @@ switch ($action) {
case 'activation-post':
$code = _post('code');
$v1 = ORM::for_table('tbl_voucher')->where('code', $code)->where('status', 0)->find_one();
$c = ORM::for_table('tbl_customers')->find_one($user['id']);
$p = ORM::for_table('tbl_plans')->find_one($v1['id_plan']);
$b = ORM::for_table('tbl_user_recharges')->where('customer_id', $user['id'])->find_one();
$date_now = date("Y-m-d H:i:s");
$date_only = date("Y-m-d");
$time = date("H:i:s");
$mikrotik = Mikrotik::info($v1['routers']);
if ($p['validity_unit'] == 'Months') {
$date_exp = date("Y-m-d", strtotime('+' . $p['validity'] . ' month'));
} else if ($p['validity_unit'] == 'Days') {
$date_exp = date("Y-m-d", strtotime('+' . $p['validity'] . ' day'));
} else if ($p['validity_unit'] == 'Hrs') {
$datetime = explode(' ', date("Y-m-d H:i:s", strtotime('+' . $p['validity'] . ' hour')));
$date_exp = $datetime[0];
$time = $datetime[1];
} else if ($p['validity_unit'] == 'Mins') {
$datetime = explode(' ', date("Y-m-d H:i:s", strtotime('+' . $p['validity'] . ' minute')));
$date_exp = $datetime[0];
$time = $datetime[1];
}
run_hook('customer_activate_voucher'); #HOOK
if ($v1) {
if (Package::rechargeUser($user['id'], $v1['routers'], $v1['id_plan'], "Activation", "Voucher")) {
if ($v1['type'] == 'Hotspot') {
if ($b) {
if (!$config['radius_mode']) {
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
Mikrotik::removeHotspotUser($client, $c['username']);
Mikrotik::addHotspotUser($client, $p, $c);
}
$b->customer_id = $user['id'];
$b->username = $c['username'];
$b->plan_id = $v1['id_plan'];
$b->namebp = $p['name_plan'];
$b->recharged_on = $date_only;
$b->expiration = $date_exp;
$b->time = $time;
$b->status = "on";
$b->method = "voucher";
$b->routers = $v1['routers'];
$b->type = "Hotspot";
$b->save();
// insert table transactions
$t = ORM::for_table('tbl_transactions')->create();
$t->invoice = "INV-" . Package::_raid(5);
$t->username = $c['username'];
$t->plan_name = $p['name_plan'];
$t->price = $p['price'];
$t->recharged_on = $date_only;
$t->expiration = $date_exp;
$t->time = $time;
$t->method = "voucher";
$t->routers = $v1['routers'];
$t->type = "Hotspot";
$t->save();
} else {
if (!$config['radius_mode']) {
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
Mikrotik::addHotspotUser($client, $p, $c);
}
$d = ORM::for_table('tbl_user_recharges')->create();
$d->customer_id = $user['id'];
$d->username = $c['username'];
$d->plan_id = $v1['id_plan'];
$d->namebp = $p['name_plan'];
$d->recharged_on = $date_only;
$d->expiration = $date_exp;
$d->time = $time;
$d->status = "on";
$d->method = "voucher";
$d->routers = $v1['routers'];
$d->type = "Hotspot";
$d->save();
// insert table transactions
$t = ORM::for_table('tbl_transactions')->create();
$t->invoice = "INV-" . Package::_raid(5);
$t->username = $c['username'];
$t->plan_name = $p['name_plan'];
$t->price = $p['price'];
$t->recharged_on = $date_only;
$t->expiration = $date_exp;
$t->time = $time;
$t->method = "voucher";
$t->routers = $v1['routers'];
$t->type = "Hotspot";
$t->save();
}
$v1->status = "1";
$v1->user = $user['username'];
$v1->user = $c['username'];
$v1->save();
r2(U . "voucher/list-activated", 's', $_L['Activation_Vouchers_Successfully']);
// Telegram to Admin
Message::sendTelegram('#u' . $c['username'] . " Activate #Voucher #Hotspot\n" . $p['name_plan'] .
"\nCode: " . $code .
"\nRouter: " . $v1['routers'] .
"\nPrice: " . $p['price']);
} else {
r2(U . 'voucher/activation', 'e', "Failed to refill account");
if ($b) {
if (!$config['radius_mode']) {
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
Mikrotik::removePpoeUser($client, $c['username']);
Mikrotik::addPpoeUser($client, $p, $c);
}
$b->customer_id = $user['id'];
$b->username = $c['username'];
$b->plan_id = $v1['id_plan'];
$b->namebp = $p['name_plan'];
$b->recharged_on = $date_only;
$b->expiration = $date_exp;
$b->time = $time;
$b->status = "on";
$b->method = "voucher";
$b->routers = $v1['routers'];
$b->type = "PPPOE";
$b->save();
// insert table transactions
$t = ORM::for_table('tbl_transactions')->create();
$t->invoice = "INV-" . Package::_raid(5);
$t->username = $c['username'];
$t->plan_name = $p['name_plan'];
$t->price = $p['price'];
$t->recharged_on = $date_only;
$t->expiration = $date_exp;
$t->time = $time;
$t->method = "voucher";
$t->routers = $v1['routers'];
$t->type = "PPPOE";
$t->save();
} else {
if (!$config['radius_mode']) {
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
Mikrotik::addPpoeUser($client, $p, $c);
}
$d = ORM::for_table('tbl_user_recharges')->create();
$d->customer_id = $user['id'];
$d->username = $c['username'];
$d->plan_id = $v1['id_plan'];
$d->namebp = $p['name_plan'];
$d->recharged_on = $date_only;
$d->expiration = $date_exp;
$d->time = $time;
$d->status = "on";
$d->method = "voucher";
$d->routers = $v1['routers'];
$d->type = "PPPOE";
$d->save();
// insert table transactions
$t = ORM::for_table('tbl_transactions')->create();
$t->invoice = "INV-" . Package::_raid(5);
$t->username = $c['username'];
$t->plan_name = $p['name_plan'];
$t->price = $p['price'];
$t->recharged_on = $date_only;
$t->expiration = $date_exp;
$t->time = $time;
$t->method = "voucher";
$t->routers = $v1['routers'];
$t->type = "PPPOE";
$t->save();
}
$v1->status = "1";
$v1->user = $c['username'];
$v1->save();
// Telegram to Admin
Message::sendTelegram('#u' . $c['username'] . " Activate #Voucher #PPPOE\n" . $p['name_plan'] .
"\nCode: " . $code .
"\nRouter: " . $v1['routers'] .
"\nPrice: " . $p['price']);
}
r2(U . "voucher/list-activated", 's', $_L['Activation_Vouchers_Successfully']);
} else {
r2(U . 'voucher/activation', 'e', $_L['Voucher_Not_Valid']);
}

View File

@ -4,34 +4,10 @@
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
**/
// on some server, it getting error because of slash is backwards
function _autoloader($class)
{
if (strpos($class, '_') !== false) {
$class = str_replace('_', DIRECTORY_SEPARATOR, $class);
if (file_exists(__DIR__.DIRECTORY_SEPARATOR.'autoload' . DIRECTORY_SEPARATOR . $class . '.php')) {
include __DIR__.DIRECTORY_SEPARATOR.'autoload' . DIRECTORY_SEPARATOR . $class . '.php';
} else {
$class = str_replace("\\", DIRECTORY_SEPARATOR, $class);
if (file_exists(__DIR__ . DIRECTORY_SEPARATOR . 'autoload' . DIRECTORY_SEPARATOR . $class . '.php'))
include __DIR__ . DIRECTORY_SEPARATOR . 'autoload' . DIRECTORY_SEPARATOR . $class . '.php';
}
} else {
if (file_exists(__DIR__.DIRECTORY_SEPARATOR.'autoload' . DIRECTORY_SEPARATOR . $class . '.php')) {
include __DIR__.DIRECTORY_SEPARATOR.'autoload' . DIRECTORY_SEPARATOR . $class . '.php';
} else {
$class = str_replace("\\", DIRECTORY_SEPARATOR, $class);
if (file_exists(__DIR__ . DIRECTORY_SEPARATOR . 'autoload' . DIRECTORY_SEPARATOR . $class . '.php'))
include __DIR__ . DIRECTORY_SEPARATOR . 'autoload' . DIRECTORY_SEPARATOR . $class . '.php';
}
}
}
spl_autoload_register('_autoloader');
require('../config.php');
require('orm.php');
require_once '../config.php';
require_once 'orm.php';
require_once 'autoload/PEAR2/Autoload.php';
include "autoload/Hookers.php";
ORM::configure("mysql:host=$db_host;dbname=$db_name");
ORM::configure('username', $db_user);
@ -40,17 +16,45 @@ ORM::configure('return_result_sets', true);
ORM::configure('logging', true);
include "autoload/Hookers.php";
// notification message
if (file_exists("uploads/notifications.json")) {
$_notifmsg = json_decode(file_get_contents('uploads/notifications.json'), true);
} else {
$_notifmsg = json_decode(file_get_contents('uploads/notifications.default.json'), true);
}
$_notifmsg_default = json_decode(file_get_contents('uploads/notifications.default.json'), true);
//register all plugin
foreach (glob(File::pathFixer("plugin/*.php")) as $filename) {
foreach (glob("plugin/*.php") as $filename) {
include $filename;
}
// on some server, it getting error because of slash is backwards
function _autoloader($class)
{
if (strpos($class, '_') !== false) {
$class = str_replace('_', DIRECTORY_SEPARATOR, $class);
if (file_exists('autoload' . DIRECTORY_SEPARATOR . $class . '.php')) {
include 'autoload' . DIRECTORY_SEPARATOR . $class . '.php';
} else {
$class = str_replace("\\", DIRECTORY_SEPARATOR, $class);
if (file_exists(__DIR__ . DIRECTORY_SEPARATOR . 'autoload' . DIRECTORY_SEPARATOR . $class . '.php'))
include __DIR__ . DIRECTORY_SEPARATOR . 'autoload' . DIRECTORY_SEPARATOR . $class . '.php';
}
} else {
if (file_exists('autoload' . DIRECTORY_SEPARATOR . $class . '.php')) {
include 'autoload' . DIRECTORY_SEPARATOR . $class . '.php';
} else {
$class = str_replace("\\", DIRECTORY_SEPARATOR, $class);
if (file_exists(__DIR__ . DIRECTORY_SEPARATOR . 'autoload' . DIRECTORY_SEPARATOR . $class . '.php'))
include __DIR__ . DIRECTORY_SEPARATOR . 'autoload' . DIRECTORY_SEPARATOR . $class . '.php';
}
}
}
spl_autoload_register('_autoloader');
$result = ORM::for_table('tbl_appconfig')->find_many();
foreach ($result as $value) {
$config[$value['setting']] = $value['value'];
@ -60,10 +64,10 @@ $_c = $config;
date_default_timezone_set($config['timezone']);
$textExpired = Lang::getNotifText('expired');
$textExpired = $_notifmsg['expired'];
$d = ORM::for_table('tbl_user_recharges')->where('status', 'on')->find_many();
$d = ORM::for_table('tbl_user_recharges')->where('status', 'on')->where_lte('expiration', date("Y-m-d"))->find_many();
echo "Found " . count($d) . " user(s)\n";
run_hook('cronjob'); #HOOK
foreach ($d as $ds) {
@ -76,16 +80,11 @@ foreach ($d as $ds) {
$u = ORM::for_table('tbl_user_recharges')->where('id', $ds['id'])->find_one();
$c = ORM::for_table('tbl_customers')->where('id', $ds['customer_id'])->find_one();
$m = ORM::for_table('tbl_routers')->where('name', $ds['routers'])->find_one();
$p = ORM::for_table('tbl_plans')->where('id', $u['plan_id'])->find_one();
if (!$_c['radius_mode']) {
$client = Mikrotik::getClient($m['ip_address'], $m['username'], $m['password']);
Mikrotik::setHotspotLimitUptime($client, $c['username']);
Mikrotik::removeHotspotActiveUser($client, $c['username']);
if(!empty($p['pool_expired'])){
Mikrotik::setHotspotUserPackage($client, $c['username'], 'EXPIRED NUXBILL '.$p['pool_expired']);
}else{
Mikrotik::removeHotspotUser($client, $c['username']);
}
Message::sendPackageNotification($c['phonenumber'], $c['fullname'], $u['namebp'], $textExpired, $config['user_notification_expired']);
}
//update database user dengan status off
@ -94,6 +93,7 @@ foreach ($d as $ds) {
// autorenewal from deposit
if ($config['enable_balance'] == 'yes' && $c['auto_renewal']) {
$p = ORM::for_table('tbl_plans')->where('id', $u['plan_id'])->find_one();
if ($p && $p['enabled'] && $c['balance'] >= $p['price']) {
if (Package::rechargeUser($ds['customer_id'], $p['routers'], $p['id'], 'Customer', 'Balance')) {
// if success, then get the balance
@ -107,10 +107,10 @@ foreach ($d as $ds) {
"\nRouter: " . $router_name .
"\nPrice: " . $p['price']);
}
} else {
}else{
echo "no renewall | plan enabled: $p[enabled] | User balance: $c[balance] | price $p[price]\n";
}
} else {
}else{
echo "no renewall | balance $config[enable_balance] auto_renewal $c[auto_renewal]\n";
}
} else echo " : ACTIVE \r\n";
@ -123,16 +123,11 @@ foreach ($d as $ds) {
$u = ORM::for_table('tbl_user_recharges')->where('id', $ds['id'])->find_one();
$c = ORM::for_table('tbl_customers')->where('id', $ds['customer_id'])->find_one();
$m = ORM::for_table('tbl_routers')->where('name', $ds['routers'])->find_one();
$p = ORM::for_table('tbl_plans')->where('id', $u['plan_id'])->find_one();
if (!$_c['radius_mode']) {
$client = Mikrotik::getClient($m['ip_address'], $m['username'], $m['password']);
Mikrotik::disablePpoeUser($client, $c['username']);
Mikrotik::removePpoeActive($client, $c['username']);
if(!empty($p['pool_expired'])){
Mikrotik::setPpoeUserPlan($client, $c['username'], 'EXPIRED NUXBILL '.$p['pool_expired']);
}else{
Mikrotik::removePpoeUser($client, $c['username']);
}
Message::sendPackageNotification($c['phonenumber'], $c['fullname'], $u['namebp'], $textExpired, $config['user_notification_expired']);
}
@ -141,16 +136,13 @@ foreach ($d as $ds) {
// autorenewal from deposit
if ($config['enable_balance'] == 'yes' && $c['auto_renewal']) {
$p = ORM::for_table('tbl_plans')->where('id', $u['plan_id'])->find_one();
if ($p && $p['enabled'] && $c['balance'] >= $p['price']) {
if (Package::rechargeUser($ds['customer_id'], $p['routers'], $p['id'], 'Customer', 'Balance')) {
// if success, then get the balance
Balance::min($ds['customer_id'], $p['price']);
echo "plan enabled: $p[enabled] | User balance: $c[balance] | price $p[price]\n";
echo "auto renewall Success\n";
} else {
echo "plan enabled: $p[enabled] | User balance: $c[balance] | price $p[price]\n";
echo "auto renewall Failed\n";
Message::sendTelegram("FAILED RENEWAL #cron\n\n#u$c[username] #buy #PPPOE \n" . $p['name_plan'] .
Message::sendTelegram("FAILED RENEWAL #cron\n\n#u$c[username] #buy #Hotspot \n" . $p['name_plan'] .
"\nRouter: " . $router_name .
"\nPrice: " . $p['price']);
}

View File

@ -7,34 +7,10 @@
* 0 7 * * * /usr/bin/php /var/www/system/cron_reminder.php
**/
// on some server, it getting error because of slash is backwards
function _autoloader($class)
{
if (strpos($class, '_') !== false) {
$class = str_replace('_', DIRECTORY_SEPARATOR, $class);
if (file_exists(__DIR__.DIRECTORY_SEPARATOR.'autoload' . DIRECTORY_SEPARATOR . $class . '.php')) {
include __DIR__.DIRECTORY_SEPARATOR.'autoload' . DIRECTORY_SEPARATOR . $class . '.php';
} else {
$class = str_replace("\\", DIRECTORY_SEPARATOR, $class);
if (file_exists(__DIR__ . DIRECTORY_SEPARATOR . 'autoload' . DIRECTORY_SEPARATOR . $class . '.php'))
include __DIR__ . DIRECTORY_SEPARATOR . 'autoload' . DIRECTORY_SEPARATOR . $class . '.php';
}
} else {
if (file_exists(__DIR__.DIRECTORY_SEPARATOR.'autoload' . DIRECTORY_SEPARATOR . $class . '.php')) {
include __DIR__.DIRECTORY_SEPARATOR.'autoload' . DIRECTORY_SEPARATOR . $class . '.php';
} else {
$class = str_replace("\\", DIRECTORY_SEPARATOR, $class);
if (file_exists(__DIR__ . DIRECTORY_SEPARATOR . 'autoload' . DIRECTORY_SEPARATOR . $class . '.php'))
include __DIR__ . DIRECTORY_SEPARATOR . 'autoload' . DIRECTORY_SEPARATOR . $class . '.php';
}
}
}
spl_autoload_register('_autoloader');
require('../config.php');
require('orm.php');
require_once '../config.php';
require_once 'orm.php';
require_once 'autoload/PEAR2/Autoload.php';
include "autoload/Hookers.php";
require_once 'autoload/PEAR2/Autoload.php';
ORM::configure("mysql:host=$db_host;dbname=$db_name");
ORM::configure('username', $db_user);
@ -42,17 +18,46 @@ ORM::configure('password', $db_password);
ORM::configure('return_result_sets', true);
ORM::configure('logging', true);
include "autoload/Hookers.php";
// notification message
if (file_exists("uploads/notifications.json")) {
$_notifmsg = json_decode(file_get_contents('uploads/notifications.json'), true);
if(file_exists("uploads/notifications.json")){
$_notifmsg =json_decode(file_get_contents('uploads/notifications.json'), true);
}else{
$_notifmsg = json_decode(file_get_contents('uploads/notifications.default.json'), true);
}
$_notifmsg_default = json_decode(file_get_contents('uploads/notifications.default.json'), true);
//register all plugin
foreach (glob(File::pathFixer("plugin/*.php")) as $filename) {
foreach (glob("plugin/*.php") as $filename) {
include $filename;
}
// on some server, it getting error because of slash is backwards
function _autoloader($class)
{
if (strpos($class, '_') !== false) {
$class = str_replace('_', DIRECTORY_SEPARATOR, $class);
if (file_exists('autoload' . DIRECTORY_SEPARATOR . $class . '.php')) {
include 'autoload' . DIRECTORY_SEPARATOR . $class . '.php';
} else {
$class = str_replace("\\", DIRECTORY_SEPARATOR, $class);
if (file_exists(__DIR__ . DIRECTORY_SEPARATOR . 'autoload' . DIRECTORY_SEPARATOR . $class . '.php'))
include __DIR__ . DIRECTORY_SEPARATOR . 'autoload' . DIRECTORY_SEPARATOR . $class . '.php';
}
} else {
if (file_exists('autoload' . DIRECTORY_SEPARATOR . $class . '.php')) {
include 'autoload' . DIRECTORY_SEPARATOR . $class . '.php';
} else {
$class = str_replace("\\", DIRECTORY_SEPARATOR, $class);
if (file_exists(__DIR__ . DIRECTORY_SEPARATOR . 'autoload' . DIRECTORY_SEPARATOR . $class . '.php'))
include __DIR__ . DIRECTORY_SEPARATOR . 'autoload' . DIRECTORY_SEPARATOR . $class . '.php';
}
}
}
spl_autoload_register('_autoloader');
$result = ORM::for_table('tbl_appconfig')->find_many();
foreach ($result as $value) {
$config[$value['setting']] = $value['value'];
@ -69,17 +74,17 @@ run_hook('cronjob_reminder'); #HOOK
$day7 = date('Y-m-d', strtotime("+7 day"));
$day3 = date('Y-m-d', strtotime("+3 day"));
$day1 = date('Y-m-d', strtotime("+1 day"));
print_r([$day1, $day3, $day7]);
print_r([$day1,$day3,$day7]);
foreach ($d as $ds) {
if (in_array($ds['expiration'], [$day1, $day3, $day7])) {
if(in_array($ds['expiration'],[$day1,$day3,$day7])){
$u = ORM::for_table('tbl_user_recharges')->where('id', $ds['id'])->find_one();
$c = ORM::for_table('tbl_customers')->where('id', $ds['customer_id'])->find_one();
if ($ds['expiration'] == $day7) {
echo Message::sendPackageNotification($c['phonenumber'], $c['fullname'], $u['namebp'], Lang::getNotifText('reminder_7_day'), $config['user_notification_reminder']) . "\n";
} else if ($ds['expiration'] == $day3) {
echo Message::sendPackageNotification($c['phonenumber'], $c['fullname'], $u['namebp'], Lang::getNotifText('reminder_3_day'), $config['user_notification_reminder']) . "\n";
} else if ($ds['expiration'] == $day1) {
echo Message::sendPackageNotification($c['phonenumber'], $c['fullname'], $u['namebp'], Lang::getNotifText('reminder_1_day'), $config['user_notification_reminder']) . "\n";
if($ds['expiration']==$day7){
echo Message::sendPackageNotification($c['phonenumber'], $c['fullname'], $u['namebp'], $_notifmsg['reminder_7_day'], $config['user_notification_reminder'])."\n";
}else if($ds['expiration']==$day3){
echo Message::sendPackageNotification($c['phonenumber'], $c['fullname'], $u['namebp'], $_notifmsg['reminder_3_day'], $config['user_notification_reminder'])."\n";
}else if($ds['expiration']==$day1){
echo Message::sendPackageNotification($c['phonenumber'], $c['fullname'], $u['namebp'], $_notifmsg['reminder_1_day'], $config['user_notification_reminder'])."\n";
}
}
}

View File

@ -359,31 +359,9 @@ $_L['Balance_Plans'] = 'Balance Plans';
$_L['Buy_Balance'] = 'Buy Balance?';
$_L['Price'] = 'Price';
$_L['Validity'] = 'Validity';
$_L['Disable_auto_renewal'] = 'Disable auto renewal?';
$_L['Auto_Renewal_On'] = 'Auto Renewal On';
$_L['Enable_auto_renewal'] = 'Enable auto renewal?';
$_L['Auto_Renewal_Off'] = 'Auto Renewal Off';
$_L['Refill_Balance'] = 'Refill Balance';
$_L['Invoice_Footer'] = 'Invoice Footer';
$_L['Pay_With_Balance'] = 'Pay With Balance';
$_L['Pay_this_with_Balance_your_active_package_will_be_overwrite'] = 'Pay this with Balance? your active package will be overwrite';
$_L['Success_to_buy_package'] = 'Success to buy package';
$_L['Auto_Renewal'] = 'Auto Renewal';
$_L['View'] = 'View';
$_L['Back'] = 'Back';
$_L['Active'] = 'Active';
$_L['Transfer_Balance'] = 'Transfer Balance';
$_L['Send_your_balance'] = 'Send your balance?';
$_L['Send'] = 'Send';
$_L['Cannot_send_to_yourself'] = 'Cannot send to yourself';
$_L['Sending_balance_success'] = 'Sending balance success';
$_L['From'] = 'From';
$_L['To'] = 'To';
$_L['insufficient_balance'] = 'insufficient balance';
$_L['Send_Balance'] = 'Send Balance';
$_L['Received_Balance'] = 'Received Balance';
$_L['Minimum_Balance_Transfer'] = 'Minimum Balance Transfer';
$_L['Minimum_Transfer'] = 'Minimum Transfer';
$_L['Company_Logo'] = 'Company Logo';
$_L['Expired_IP_Pool'] = 'Expired IP Pool';
$_L['Expired_IP_Pool'] = 'Expired IP Pool';
$_L['Disable_auto_renewal'] = 'Disable auto renewal?';
$_L['Auto_Renewal_On'] = 'Auto Renewal On';
$_L['Enable_auto_renewal'] = 'Enable auto renewal?';
$_L['Auto_Renewal_Off'] = 'Auto Renewal Off';
$_L['Refill_Balance'] = 'Refill Balance';
$_L['Invoice_Footer'] = 'Invoice Footer';

View File

@ -338,11 +338,3 @@ $_L['Country_Code_Phone'] = 'Kode Negara Telepon';
$_L['Voucher_activation_menu_will_be_hidden'] = 'Info Pembelian Voucher dan Redeem akan disembunyikan';
$_L['Customer_can_deposit_money_to_buy_voucher'] = 'Pelanggan dapat topup saldo untuk langganan Internet';
$_L['Allow_balance_transfer_between_customers'] = 'Bolehkan transfer saldo antar pelanggan';
$_L['Refill_Balance'] = 'Refill Balance';
$_L['Balance_Plans'] = 'Balance Plans';
$_L['Expired_IP_Pool'] = 'Expired IP Pool';
$_L['Company_Logo'] = 'Company Logo';
$_L['Disable_Voucher'] = 'Disable Voucher';
$_L['Minimum_Balance_Transfer'] = 'Minimum Balance Transfer';
$_L['Reminder_Notification'] = 'Reminder Notification';
$_L['Invoice_Footer'] = 'Invoice Footer';

View File

@ -340,5 +340,4 @@ $_L['Invoice'] = 'Invoice';
$_L['Country_Code_Phone'] = 'Country Code Phone';
$_L['Voucher_activation_menu_will_be_hidden'] = 'Voucher activation menu will be hidden';
$_L['Customer_can_deposit_money_to_buy_voucher'] = 'Customer can deposit money to buy voucher';
$_L['Allow_balance_transfer_between_customers'] = 'Allow balance transfer between customers';$_L['Refill_Balance'] = 'Refill Balance';
$_L['Balance_Plans'] = 'Balance Plans';
$_L['Allow_balance_transfer_between_customers'] = 'Allow balance transfer between customers';

File diff suppressed because it is too large Load Diff

View File

@ -7,12 +7,11 @@ if(php_sapi_name() !== 'cli'){
die("RUN ON COMMAND LINE ONLY BY RADIUS ENGINE");
}
require_once __DIR__.File::pathFixer('/../config.php');
require_once __DIR__.File::pathFixer('orm.php');
require_once __DIR__.File::pathFixer('/autoload/PEAR2/Autoload.php');
include __DIR__.File::pathFixer("/autoload/Hookers.php");
require(__DIR__.'/../config.php');
require(__DIR__.'/orm.php');
use PEAR2\Net\RouterOS;
require_once 'autoload/PEAR2/Autoload.php';
ORM::configure("mysql:host=$db_host;dbname=$db_name");
ORM::configure('username', $db_user);

View File

@ -10,16 +10,5 @@
"ALTER TABLE `tbl_plans` CHANGE `type` `type` ENUM('Hotspot','PPPOE','Balance') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL;",
"ALTER TABLE `tbl_transactions` CHANGE `type` `type` ENUM('Hotspot','PPPOE','Balance') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL;",
"ALTER TABLE `tbl_customers` ADD `auto_renewal` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'Auto renewall using balance' AFTER `balance`;"
],
"2023.8.23" : [
"ALTER TABLE `tbl_customers` CHANGE `pppoe_password` `pppoe_password` VARCHAR(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '0' COMMENT 'For PPPOE Login';"
],
"2023.8.28" : [
"ALTER TABLE `tbl_user_recharges` ADD `recharged_time` time NOT NULL DEFAULT '00:00:00' AFTER `recharged_on`;",
"ALTER TABLE `tbl_transactions` ADD `recharged_time` time NOT NULL DEFAULT '00:00:00' AFTER `recharged_on`;"
],
"2023.9.5" : [
"DROP TABLE `tbl_language`;",
"ALTER TABLE `tbl_plans` ADD `pool_expired` varchar(40) NOT NULL DEFAULT '' AFTER `pool`;"
]
}

View File

@ -1,7 +1,5 @@
{
"expired": "Hello [[name]], your internet package [[package]] has been expired.",
"balance_send": "You sent [[balance]] to [[name]].",
"balance_received": "You have received [[balance]] from [[name]].",
"reminder_7_day": "Hello *[[name]]*, \r\nyour internet package *[[package]]* will be expired in 7 days.",
"reminder_3_day": "Hello *[[name]]*, \r\nyour internet package *[[package]]* will be expired in 3 days.",
"reminder_1_day": "Hello *[[name]]*,\r\n your internet package *[[package]]* will be expired tomorrow.",

View File

@ -45,16 +45,18 @@
</div>
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Default_Language']}</label>
<div class="col-md-6">
<div class="col-md-4">
<select class="form-control" name="lan" id="lan">
{foreach $lan as $lans}
<option value="{$lans}" {if $_c['language'] eq $lans}
selected="selected" {/if}>{$lans}</option>
<option value="{$lans['folder']}" {if $_c['language'] eq $lans['folder']}
selected="selected" {/if}>{$lans['name']}</option>
{/foreach}
</select>
</div>
<div class="col-md-4 help-block">
To add new Language, just add the folder, it will automatically detected
<div class="col-md-2">
<a href="{$_url}settings/language" type="button"
class="btn btn-line-success btn-icon-inline"><i
class="ion ion-android-add"></i>{$_L['Add_Language']}</a>
</div>
</div>
<div class="form-group">
@ -76,8 +78,8 @@
<div class="col-md-6">
<input type="text" class="form-control" id="currency_code" name="currency_code"
value="{$_c['currency_code']}">
<span class="help-block">{$_L['currency_help']}</span>
</div>
<span class="help-block col-md-4">{$_L['currency_help']}</span>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Country Code Phone')}</label>

View File

@ -113,32 +113,6 @@
</p>
</div>
</div>
<div class="panel-body">
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Send Balance')}</label>
<div class="col-md-6">
<textarea class="form-control" id="balance_send" name="balance_send"
rows="3">{if $_json['balance_send']}{Lang::htmlspecialchars($_json['balance_send'])}{else}{Lang::htmlspecialchars($_default['balance_send'])}{/if}</textarea>
</div>
<p class="col-md-4 help-block">
<b>[[name]]</b> Receiver name.<br>
<b>[[balance]]</b> how much balance have been send.
</p>
</div>
</div>
<div class="panel-body">
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Received Balance')}</label>
<div class="col-md-6">
<textarea class="form-control" id="balance_received" name="balance_received"
rows="3">{if $_json['balance_received']}{Lang::htmlspecialchars($_json['balance_received'])}{else}{Lang::htmlspecialchars($_default['balance_received'])}{/if}</textarea>
</div>
<p class="col-md-4 help-block">
<b>[[name]]</b> Sender name.<br>
<b>[[balance]]</b> how much balance have been received.
</p>
</div>
</div>
</div>
<div class="panel-body">

View File

@ -1,6 +1,6 @@
{include file="sections/header.tpl"}
<form class="form-horizontal" method="post" role="form" action="{$_url}settings/app-post" enctype="multipart/form-data">
<form class="form-horizontal" method="post" role="form" action="{$_url}settings/app-post">
<div class="row">
<div class="col-sm-12 col-md-12">
<div class="panel panel-primary panel-hovered panel-stacked mb30">
@ -17,19 +17,10 @@
<div class="col-md-6">
<input type="text" required class="form-control" id="company" name="company"
value="{$_c['CompanyName']}">
</div>
<span class="help-block col-md-4">{$_L['App_Name_Help_Text']}</span>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Company Logo')}</label>
<div class="col-md-6">
<input type="file" class="form-control" id="logo" name="logo" accept="image/*">
<span class="help-block">For PDF Reports | Best size 1078 x 200 | uploaded image will be autosize</span>
</div>
<span class="help-block col-md-4">
<a href="./{$logo}" target="_blank"><img src="./{$logo}" height="48" alt="logo for PDF"></a>
</span>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Company Footer')}</label>
<div class="col-md-6">
@ -116,13 +107,6 @@
</div>
<p class="help-block col-md-4">{Lang::T('Allow balance transfer between customers')}</p>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Minimum Balance Transfer')}</label>
<div class="col-md-6">
<input type="number" class="form-control" id="minimum_transfer" name="minimum_transfer"
value="{$_c['minimum_transfer']}">
</div>
</div>
</div>
<div class="panel-heading">
<div class="btn-group pull-right">

View File

@ -1,4 +1,4 @@
<option value=''>{$_L['Select_Pool']}</option>
{foreach $d as $ds}
<option value="{$ds['pool_name']}">{$ds['pool_name']}</option>
{/foreach}

View File

@ -1,4 +1,4 @@
<option value=''>{$_L['Select_Routers']}</option>
<option value="">Select Routers</option>
{foreach $d as $ds}
<option value="{$ds['name']}">{$ds['name']}</option>
{/foreach}

View File

@ -142,7 +142,8 @@
<div class="box-footer" id="latestVersion">ver</div>
<div class="box-footer">
<div class="btn-group btn-group-justified" role="group" aria-label="...">
<a href="./update.php" class="btn btn-success btn-sm btn-block">Install Latest Version</a>
<a href="./update.php" target="_blank" class="btn btn-success btn-sm btn-block">Install Latest
Version</a>
<a href="https://github.com/hotspotbilling/phpnuxbill/archive/refs/heads/master.zip" target="_blank"
class="btn btn-warning btn-sm btn-block">Download Latest Version</a>
</div>

View File

@ -1,91 +1,76 @@
{include file="sections/header.tpl"}
<div class="row">
<div class="col-sm-12 col-md-12">
<div class="panel panel-primary panel-hovered panel-stacked mb30">
<div class="panel-heading">{$_L['Add_Contact']}</div>
<div class="panel-body">
<div class="row">
<div class="col-sm-12 col-md-12">
<div class="panel panel-primary panel-hovered panel-stacked mb30">
<div class="panel-heading">{$_L['Add_Contact']}</div>
<div class="panel-body">
<form class="form-horizontal" method="post" role="form" action="{$_url}customers/add-post">
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Username']}</label>
<div class="col-md-6">
<div class="input-group">
{if $_c['country_code_phone']!= ''}
<span class="input-group-addon" id="basic-addon1">+</span>
{else}
<span class="input-group-addon" id="basic-addon1"><i
class="glyphicon glyphicon-phone-alt"></i></span>
{/if}
<input type="text" class="form-control" name="username" required
placeholder="{if $_c['country_code_phone']!= ''}{$_c['country_code_phone']}{/if} {$_L['Phone_Number']}">
<form class="form-horizontal" method="post" role="form" action="{$_url}customers/add-post" >
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Username']}</label>
<div class="col-md-6">
<div class="input-group">
<span class="input-group-addon">+</span>
<input type="text" class="form-control" name="username" required
placeholder="{if $_c['country_code_phone']!= ''}{$_c['country_code_phone']}{/if} {$_L['Phone_Number']}">
</div>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Full_Name']}</label>
<div class="col-md-6">
<input type="text" required class="form-control" id="fullname" name="fullname">
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Email']}</label>
<div class="col-md-6">
<input type="email" class="form-control" id="email" name="email">
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Phone_Number']}</label>
<div class="col-md-6">
<div class="input-group">
<span class="input-group-addon">+</span>
<input type="text" class="form-control" name="phonenumber"
placeholder="{if $_c['country_code_phone']!= ''}{$_c['country_code_phone']}{/if} {$_L['Phone_Number']}">
</div>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Password']}</label>
<div class="col-md-6">
<input type="password" class="form-control" autocomplete="off" required id="password" name="password" onmouseleave="this.type = 'password'" onmouseenter="this.type = 'text'">
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('PPPOE Password')}</label>
<div class="col-md-6">
<input type="password" class="form-control" id="pppoe_password" name="pppoe_password" value="{$d['pppoe_password']}" onmouseleave="this.type = 'password'" onmouseenter="this.type = 'text'">
<span class="help-block">{Lang::T('User Cannot change this, only admin. if it Empty it will use user password')}</span>
</div>
</div>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Full_Name']}</label>
<div class="col-md-6">
<input type="text" required class="form-control" id="fullname" name="fullname">
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Email']}</label>
<div class="col-md-6">
<input type="email" class="form-control" id="email" name="email">
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Phone_Number']}</label>
<div class="col-md-6">
<div class="input-group">
{if $_c['country_code_phone']!= ''}
<span class="input-group-addon" id="basic-addon1">+</span>
{else}
<span class="input-group-addon" id="basic-addon1"><i
class="glyphicon glyphicon-phone-alt"></i></span>
{/if}
<input type="text" class="form-control" name="phonenumber"
placeholder="{if $_c['country_code_phone']!= ''}{$_c['country_code_phone']}{/if} {$_L['Phone_Number']}">
</div>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Password']}</label>
<div class="col-md-6">
<input type="password" class="form-control" autocomplete="off" required id="password"
name="password" onmouseleave="this.type = 'password'" onmouseenter="this.type = 'text'">
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('PPPOE Password')}</label>
<div class="col-md-6">
<input type="password" class="form-control" id="pppoe_password" name="pppoe_password"
value="{$d['pppoe_password']}" onmouseleave="this.type = 'password'"
onmouseenter="this.type = 'text'">
<span
class="help-block">{Lang::T('User Cannot change this, only admin. if it Empty it will use user password')}</span>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Address']}</label>
<div class="col-md-6">
<textarea name="address" id="address" class="form-control"></textarea>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Address']}</label>
<div class="col-md-6">
<textarea name="address" id="address" class="form-control"></textarea>
</div>
</div>
<div class="form-group">
<div class="col-lg-offset-2 col-lg-10">
<button class="btn btn-primary waves-effect waves-light"
type="submit">{$_L['Save']}</button>
Or <a href="{$_url}customers/list">{$_L['Cancel']}</a>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<div class="form-group">
<div class="col-lg-offset-2 col-lg-10">
<button class="btn btn-primary waves-effect waves-light" type="submit">{$_L['Save']}</button>
Or <a href="{$_url}customers/list">{$_L['Cancel']}</a>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
{include file="sections/footer.tpl"}
{include file="sections/footer.tpl"}

View File

@ -1,95 +1,77 @@
{include file="sections/header.tpl"}
<div class="row">
<div class="col-sm-12 col-md-12">
<div class="panel panel-primary panel-hovered panel-stacked mb30">
<div class="panel-heading">{$_L['Edit_Contact']}</div>
<div class="panel-body">
<div class="row">
<div class="col-sm-12 col-md-12">
<div class="panel panel-primary panel-hovered panel-stacked mb30">
<div class="panel-heading">{$_L['Edit_Contact']}</div>
<div class="panel-body">
<form class="form-horizontal" method="post" role="form" action="{$_url}customers/edit-post">
<input type="hidden" name="id" value="{$d['id']}">
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Username']}</label>
<div class="col-md-6">
<div class="input-group">
{if $_c['country_code_phone']!= ''}
<span class="input-group-addon" id="basic-addon1">+</span>
{else}
<span class="input-group-addon" id="basic-addon1"><i
class="glyphicon glyphicon-phone-alt"></i></span>
{/if}
<input type="text" class="form-control" name="username" value="{$d['username']}"
required
placeholder="{if $_c['country_code_phone']!= ''}{$_c['country_code_phone']}{/if} {$_L['Phone_Number']}">
</div>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Full_Name']}</label>
<div class="col-md-6">
<input type="text" class="form-control" id="fullname" name="fullname"
value="{$d['fullname']}">
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Email']}</label>
<div class="col-md-6">
<input type="email" class="form-control" id="email" name="email" value="{$d['email']}">
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Phone_Number']}</label>
<div class="col-md-6">
<div class="input-group">
{if $_c['country_code_phone']!= ''}
<span class="input-group-addon" id="basic-addon1">+</span>
{else}
<span class="input-group-addon" id="basic-addon1"><i
class="glyphicon glyphicon-phone-alt"></i></span>
{/if}
<input type="text" class="form-control" name="phonenumber" value="{$d['phonenumber']}"
placeholder="{if $_c['country_code_phone']!= ''}{$_c['country_code_phone']}{/if} {$_L['Phone_Number']}">
</div>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Password']}</label>
<div class="col-md-6">
<input type="password" autocomplete="off" class="form-control" id="password" name="password"
onmouseleave="this.type = 'password'" onmouseenter="this.type = 'text'"
value="{$d['password']}">
<span class="help-block">{$_L['password_change_help']}</span>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('PPPOE Password')}</label>
<div class="col-md-6">
<input type="password" autocomplete="off" class="form-control" id="pppoe_password"
name="pppoe_password" value="{$d['pppoe_password']}"
onmouseleave="this.type = 'password'" onmouseenter="this.type = 'text'">
<span
class="help-block">{Lang::T('User Cannot change this, only admin. if it Empty it will use user password')}</span>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Address']}</label>
<div class="col-md-6">
<textarea name="address" id="address" class="form-control">{$d['address']}</textarea>
</div>
</div>
<form class="form-horizontal" method="post" role="form" action="{$_url}customers/edit-post" >
<input type="hidden" name="id" value="{$d['id']}">
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Username']}</label>
<div class="col-md-6">
<div class="input-group">
<span class="input-group-addon">+</span>
<input type="text" class="form-control" name="username" value="{$d['username']}" required
placeholder="{if $_c['country_code_phone']!= ''}{$_c['country_code_phone']}{/if} {$_L['Phone_Number']}">
</div>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Full_Name']}</label>
<div class="col-md-6">
<input type="text" class="form-control" id="fullname" name="fullname" value="{$d['fullname']}">
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Email']}</label>
<div class="col-md-6">
<input type="email" class="form-control" id="email" name="email" value="{$d['email']}">
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Phone_Number']}</label>
<div class="col-md-6">
<div class="input-group">
<span class="input-group-addon">+</span>
<input type="text" class="form-control" name="phonenumber" value="{$d['phonenumber']}"
placeholder="{if $_c['country_code_phone']!= ''}{$_c['country_code_phone']}{/if} {$_L['Phone_Number']}">
</div>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Password']}</label>
<div class="col-md-6">
<input type="password" autocomplete="off" class="form-control" id="password" name="password" onmouseleave="this.type = 'password'" onmouseenter="this.type = 'text'" value="{$d['password']}">
<span class="help-block">{$_L['password_change_help']}</span>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('PPPOE Password')}</label>
<div class="col-md-6">
<input type="password" autocomplete="off" class="form-control" id="pppoe_password" name="pppoe_password" value="{$d['pppoe_password']}" onmouseleave="this.type = 'password'" onmouseenter="this.type = 'text'">
<span class="help-block">{Lang::T('User Cannot change this, only admin. if it Empty it will use user password')}</span>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Address']}</label>
<div class="col-md-6">
<textarea name="address" id="address" class="form-control">{$d['address']}</textarea>
</div>
</div>
<div class="form-group">
<div class="col-lg-offset-2 col-lg-10">
<button class="btn btn-primary waves-effect waves-light"
type="submit">{$_L['Save']}</button>
Or <a href="{$_url}customers/list">{$_L['Cancel']}</a>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<div class="form-group">
<div class="col-lg-offset-2 col-lg-10">
<button class="btn btn-primary waves-effect waves-light" type="submit">{$_L['Save']}</button>
Or <a href="{$_url}customers/list">{$_L['Cancel']}</a>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
{include file="sections/footer.tpl"}
{include file="sections/footer.tpl"}

View File

@ -1,169 +0,0 @@
{include file="sections/header.tpl"}
<div class="row">
<div class="col-sm-4 col-md-4">
<div class="box box-primary">
<div class="box-body box-profile">
<img class="profile-user-img img-responsive img-circle"
src="https://robohash.org/{$d['id']}?set=set3&size=100x100&bgset=bg1"
onerror="this.src='system/uploads/user.default.jpg'" alt="avatar">
<h3 class="profile-username text-center">{$d['fullname']}</h3>
<ul class="list-group list-group-unbordered">
<li class="list-group-item">
<b>{$_L['Username']}</b> <span class="pull-right">{$d['username']}</span>
</li>
<li class="list-group-item">
<b>{$_L['Phone_Number']}</b> <span class="pull-right">{$d['phonenumber']}</span>
</li>
<li class="list-group-item">
<b>{$_L['Email']}</b> <span class="pull-right">{$d['email']}</span>
</li>
</ul>
<p class="text-muted">{Lang::nl2br($d['address'])}</p>
<ul class="list-group list-group-unbordered">
<li class="list-group-item">
<b>{$_L['Password']}</b> <span class="pull-right" style="background-color: black; color:black;"
onclick="this.select()">{$d['password']}</span>
</li>
{if $d['pppoe_password'] != ''}
<li class="list-group-item">
<b>PPPOE {$_L['Password']}</b> <span class="pull-right"
style="background-color: black; color:black;"
onclick="this.select()">{$d['pppoe_password']}</span>
</li>
{/if}
<li class="list-group-item">
<b>{Lang::T('Balance')}</b> <span class="pull-right">{Lang::moneyFormat($d['balance'])}</span>
</li>
<li class="list-group-item">
<b>{Lang::T('Auto Renewal')}</b> <span
class="pull-right">{if $d['auto_renewal']}yes{else}no{/if}</span>
</li>
<li class="list-group-item">
<b>{$_L['Created_On']}</b> <span
class="pull-right">{Lang::dateTimeFormat($d['created_at'])}</span>
</li>
<li class="list-group-item">
<b>{Lang::T('Last Login')}</b> <span
class="pull-right">{Lang::dateTimeFormat($d['last_login'])}</span>
</li>
</ul>
<div class="row">
<div class="col-xs-4">
<a href="{$_url}customers/delete/{$d['id']}" id="{$d['id']}"
class="btn btn-danger btn-block btn-sm" onclick="return confirm('{$_L['Delete']}?')"><span
class="fa fa-trash"></span></a>
</div>
<div class="col-xs-8">
<a href="{$_url}customers/edit/{$d['id']}"
class="btn btn-warning btn-sm btn-block">{$_L['Edit']}</a>
</div>
</div>
</div>
</div>
{if $package}
<div class="box box-{if $package['status']=='on'}success{else}danger{/if}">
<div class="box-body box-profile">
<h4 class="text-center">{$package['type']} - {$package['namebp']}</h4>
<ul class="list-group list-group-unbordered">
<li class="list-group-item">
{Lang::T('Active')} <span
class="pull-right">{if $package['status']=='on'}yes{else}no{/if}</span>
</li>
<li class="list-group-item">
{$_L['Created_On']} <span
class="pull-right">{Lang::dateAndTimeFormat($package['recharged_on'],$package['recharged_time'])}</span>
</li>
<li class="list-group-item">
{$_L['Expires_On']} <span
class="pull-right">{Lang::dateAndTimeFormat($package['expiration'], $package['time'])}</span>
</li>
<li class="list-group-item">
{$package['routers']} <span class="pull-right">{$package['method']}</span>
</li>
</ul>
</div>
</div>
{/if}
<a href="{$_url}customers/list" class="btn btn-primary btn-sm btn-block mt-1">{Lang::T('Back')}</a><br>
</div>
<div class="col-sm-8 col-md-8">
<ul class="nav nav-tabs">
<li role="presentation" {if $v=='order'}class="active" {/if}><a
href="{$_url}customers/view/{$d['id']}/order">30 {Lang::T('Order History')}</a></li>
<li role="presentation" {if $v=='activation'}class="active" {/if}><a
href="{$_url}customers/view/{$d['id']}/activation">30 {Lang::T('Activation History')}</a></li>
</ul>
<div class="table-responsive" style="background-color: white;">
<table id="datatable" class="table table-bordered table-striped">
{if Lang::arrayCount($activation)}
<thead>
<tr>
<th>{$_L['Username']}</th>
<th>{$_L['Plan_Name']}</th>
<th>{$_L['Plan_Price']}</th>
<th>{$_L['Type']}</th>
<th>{$_L['Created_On']}</th>
<th>{$_L['Expires_On']}</th>
<th>{$_L['Method']}</th>
</tr>
</thead>
<tbody>
{foreach $activation as $ds}
<tr>
<td>{$ds['username']}</td>
<td>{$ds['plan_name']}</td>
<td>{Lang::moneyFormat($ds['price'])}</td>
<td>{$ds['type']}</td>
<td class="text-success">{Lang::dateAndTimeFormat($ds['recharged_on'],$ds['recharged_time'])}
</td>
<td class="text-danger">{Lang::dateAndTimeFormat($ds['expiration'],$ds['time'])}</td>
<td>{$ds['method']}</td>
</tr>
{/foreach}
</tbody>
{/if}
{if Lang::arrayCount($order)}
<thead>
<tr>
<th>{$_L['Plan_Name']}</th>
<th>{Lang::T('Gateway')}</th>
<th>{Lang::T('Routers')}</th>
<th>{$_L['Type']}</th>
<th>{$_L['Plan_Price']}</th>
<th>{$_L['Created_On']}</th>
<th>{$_L['Expires_On']}</th>
<th>{Lang::T('Date Done')}</th>
<th>{$_L['Method']}</th>
</tr>
</thead>
<tbody>
{foreach $order as $ds}
<tr>
<td>{$ds['plan_name']}</td>
<td>{$ds['gateway']}</td>
<td>{$ds['routers']}</td>
<td>{$ds['payment_channel']}</td>
<td>{Lang::moneyFormat($ds['price'])}</td>
<td class="text-primary">{Lang::dateTimeFormat($ds['created_date'])}</td>
<td class="text-danger">{Lang::dateTimeFormat($ds['expired_date'])}</td>
<td class="text-success">{if $ds['status']!=1}{Lang::dateTimeFormat($ds['paid_date'])}{/if}</td>
<td>{if $ds['status']==1}{$_L['UNPAID']}
{elseif $ds['status']==2}{$_L['PAID']}
{elseif $ds['status']==3}{$_L['FAILED']}
{elseif $ds['status']==4}{$_L['CANCELED']}
{elseif $ds['status']==5}{$_L['UNKNOWN']}
{/if}</td>
</tr>
{/foreach}
</tbody>
{/if}
</table>
</div>
{$paginator['contents']}
</div>
</div>
{include file="sections/footer.tpl"}

View File

@ -9,12 +9,19 @@
<div class="col-md-8">
<form id="site-search" method="post" action="{$_url}customers/list/">
<div class="input-group">
<input type="text" name="search" value="{$search}" class="form-control"
placeholder="{Lang::T('Search')}...">
<div class="input-group-btn">
<button class="btn btn-success" type="submit"><span
class="fa fa-search"></span></button>
<div class="input-group-addon no-border">
<select name="what">
<option value="username" {if $what=='username'}selected{/if}>Username</option>
<option value="fullname" {if $what=='fullname'}selected{/if}>Name</option>
<option value="phonenumber" {if $what=='phonenumber'}selected{/if}>Phone</option>
<option value="email" {if $what=='email'}selected{/if}>Email</option>
</select>
</div>
<input type="text" name="search" value="{$search}" class="form-control"
placeholder="{$_L['Search_by_Username']}...">
<div class="input-group-btn">
<button class="btn btn-success" type="submit"><span class="fa fa-search"></span></button>
</div>
</div>
</form>
</div>
@ -27,7 +34,6 @@
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>{$_L['Manage']}</th>
<th>{$_L['Username']}</th>
<th>{$_L['Full_Name']}</th>
<th>{Lang::T('Balance')}</th>
@ -35,23 +41,27 @@
<th>{$_L['Email']}</th>
<th>{$_L['Created_On']}</th>
<th>{$_L['Recharge']}</th>
<th>{$_L['Manage']}</th>
</tr>
</thead>
<tbody>
{foreach $d as $ds}
<tr>
<td align="center">
<a href="{$_url}customers/view/{$ds['id']}" id="{$ds['id']}"
class="btn btn-success btn-sm">{Lang::T('View')}</a>
</td>
<td>{$ds['username']}</td>
<td>{$ds['fullname']}</td>
<td>{Lang::moneyFormat($ds['balance'])}</td>
<td>{$ds['phonenumber']}</td>
<td>{$ds['email']}</td>
<td>{Lang::dateTimeFormat($ds['created_at'])}</td>
<td>{$ds['created_at']}</td>
<td align="center"><a href="{$_url}prepaid/recharge-user/{$ds['id']}" id="{$ds['id']}"
class="btn btn-primary btn-sm">{$_L['Recharge']}</a></td>
<td align="center">
<a href="{$_url}customers/edit/{$ds['id']}"
class="btn btn-warning btn-sm">{$_L['Edit']}</a>
<a href="{$_url}customers/delete/{$ds['id']}" id="{$ds['id']}"
class="btn btn-danger btn-sm"
onclick="return confirm('{$_L['Delete']}?')">{$_L['Delete']}</a>
</td>
</tr>
{/foreach}
</tbody>

View File

@ -107,10 +107,10 @@
{foreach $expire as $expired}
<tr>
<td>{$no++}</td>
<td><a href="{$_url}customers/viewu/{$expired['username']}">{$expired['username']}</a></td>
<td>{Lang::dateAndTimeFormat($expired['recharged_on'],$expired['recharged_time'])}
<td>{$expired['username']}</td>
<td>{date($_c['date_format'], strtotime($expired['recharged_on']))}
</td>
<td>{Lang::dateAndTimeFormat($expired['expiration'],$expired['time'])}
<td>{date($_c['date_format'], strtotime($expired['expiration']))} {$expired['time']}
</td>
</tr>
</tbody>

View File

@ -11,6 +11,10 @@
<div class="col-md-6">
<select id="personSelect" class="form-control select2" name="id_customer" style="width: 100%"
data-placeholder="{$_L['Select_Customer']}...">
<option></option>
{foreach $c as $cs}
<option value="{$cs['id']}">{$cs['username']} - {$cs['fullname']}</option>
{/foreach}
</select>
</div>
</div>

View File

@ -69,7 +69,7 @@
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label"><a href="{$_url}bandwidth/add">{$_L['BW_Name']}</a></label>
<label class="col-md-2 control-label">{$_L['BW_Name']}</label>
<div class="col-md-6">
<select id="id_bw" name="id_bw" class="form-control select2">
<option value="">{$_L['Select_BW']}...</option>
@ -110,10 +110,9 @@
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label"><a href="{$_url}routers/add">{$_L['Router_Name']}</a></label>
<label class="col-md-2 control-label">{$_L['Router_Name']}</label>
<div class="col-md-6">
<select id="routers" name="routers" required class="form-control select2">
<option value=''>{$_L['Select_Routers']}</option>
<select id="routers" name="routers" class="form-control select2">
{foreach $r as $rs}
<option value="{$rs['name']}">{$rs['name']}</option>
{/foreach}
@ -121,16 +120,9 @@
<p class="help-block">{Lang::T('Cannot be change after saved')}</p>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label"><a href="{$_url}pool/add">{Lang::T('Expired IP Pool')}</a></label>
<div class="col-md-6">
<select id="pool_expired" name="pool_expired" class="form-control select2">
<option value=''>{$_L['Select_Pool']}</option>
</select>
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<div class="col-lg-offset-2 col-lg-10">
<button class="btn btn-success waves-effect waves-light" type="submit">{$_L['Save']}</button>
Or <a href="{$_url}services/hotspot">{$_L['Cancel']}</a>
</div>

View File

@ -70,7 +70,7 @@
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label"><a href="{$_url}bandwidth/add">{$_L['BW_Name']}</a></label>
<label class="col-md-2 control-label">{$_L['BW_Name']}</label>
<div class="col-md-6">
<select id="id_bw" name="id_bw" class="form-control select2">
{foreach $b as $bs}
@ -109,25 +109,14 @@
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label"><a href="{$_url}routers/add">{$_L['Router_Name']}</a></label>
<label class="col-md-2 control-label">{$_L['Router_Name']}</label>
<div class="col-md-6">
<input type="text" class="form-control" id="routers" name="routers" value="{$d['routers']}" readonly>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label"><a href="{$_url}pool/add">{Lang::T('Expired IP Pool')}</a></label>
<div class="col-md-6">
<select id="pool_expired" name="pool_expired" class="form-control select2">
<option value=''>{$_L['Select_Pool']}</option>
{foreach $p as $ps}
<option value="{$ps['pool_name']}" {if $d['pool_expired'] eq $ps['pool_name']} selected {/if}>{$ps['pool_name']}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<div class="col-lg-offset-2 col-lg-10">
<button class="btn btn-success waves-effect waves-light" type="submit">{$_L['Save']}</button>
Or <a href="{$_url}services/hotspot">{$_L['Cancel']}</a>
</div>

View File

@ -35,7 +35,6 @@
<th>{$_L['Data_Limit']}</th>
<th>{$_L['Plan_Validity']}</th>
<th>{$_L['Routers']}</th>
<th>{Lang::T('Expired IP Pool')}</th>
<th>{$_L['Manage']}</th>
</tr>
</thead>
@ -50,7 +49,6 @@
<td>{$ds['data_limit']} {$ds['data_unit']}</td>
<td>{$ds['validity']} {$ds['validity_unit']}</td>
<td>{$ds['routers']}</td>
<td>{$ds['pool_expired']}</td>
<td>
<a href="{$_url}services/edit/{$ds['id']}" class="btn btn-info btn-xs">{$_L['Edit']}</a>
<a href="{$_url}services/delete/{$ds['id']}" id="{$ds['id']}" onclick="return confirm('{$_L['Delete']}?')" class="btn btn-danger btn-xs">{$_L['Delete']}</a>

View File

@ -33,14 +33,15 @@
============================================<br>
{$_L['Type']} : <b>{$d['type']}</b><br>
{$_L['Plan_Name']} : <b>{$d['plan_name']}</b><br>
{$_L['Plan_Price']} : <b>{Lang::moneyFormat($d['price'])}</b><br>
{$_L['Plan_Price']} : <b>{Lang::moneyFormat($in['price'])}</b><br>
<br>
{$_L['Username']} : <b>{$d['username']}</b><br>
{$_L['Password']} : **********<br>
{if $in['type'] != 'Balance'}
<br>
{$_L['Created_On']} : <b>{Lang::dateAndTimeFormat($d['recharged_on'],$d['recharged_time'])}</b><br>
{$_L['Expires_On']} : <b>{Lang::dateAndTimeFormat($d['expiration'],$d['time'])}</b><br>
{$_L['Created_On']} : <b>{date($_c['date_format'], strtotime($d['recharged_on']))}</b><br>
{$_L['Expires_On']} : <b>{date($_c['date_format'], strtotime($d['expiration']))}
{$d['time']}</b><br>
{/if}
============================================<br>
<center>{$_c['note']}</center>

View File

@ -24,8 +24,9 @@
{$_L['Password']} : **********<br>
{if $in['type'] != 'Balance'}
<br>
{$_L['Created_On']} : <b>{Lang::dateAndTimeFormat($in['recharged_on'],$in['recharged_time'])}</b><br>
{$_L['Expires_On']} : <b>{Lang::dateAndTimeFormat($in['expiration'],$in['time'])}</b><br>
{$_L['Created_On']} : <b>{date($_c['date_format'], strtotime($in['recharged_on']))}</b><br>
{$_L['Expires_On']} : <b>{date($_c['date_format'], strtotime($in['expiration']))}
{$in['time']}</b><br>
{/if}
=====================================================<br>
<center>{$_c['note']}</center>

View File

@ -20,7 +20,7 @@
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label"><a href="{$_url}routers/add">{$_L['Routers']}</a></label>
<label class="col-md-2 control-label">{$_L['Routers']}</label>
<div class="col-md-6">
<select id="routers" name="routers" class="form-control select2">
{foreach $r as $rs}

View File

@ -24,7 +24,7 @@
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label"><a href="{$_url}bandwidth/add">{$_L['BW_Name']}</a></label>
<label class="col-md-2 control-label">{$_L['BW_Name']}</label>
<div class="col-md-6">
<select id="id_bw" name="id_bw" class="form-control select2">
<option value="">{$_L['Select_BW']}...</option>
@ -58,9 +58,9 @@
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label"><a href="{$_url}routers/add">{$_L['Router_Name']}</a></label>
<label class="col-md-2 control-label">{$_L['Router_Name']}</label>
<div class="col-md-6">
<select id="routers" name="routers" required class="form-control select2">
<select id="routers" name="routers" class="form-control select2">
<option value=''>{$_L['Select_Routers']}</option>
{foreach $r as $rs}
<option value="{$rs['name']}">{$rs['name']}</option>
@ -70,23 +70,16 @@
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label"><a href="{$_url}pool/add">{$_L['Pool']}</a></label>
<label class="col-md-2 control-label">{$_L['Pool']}</label>
<div class="col-md-6">
<select id="pool_name" name="pool_name" required class="form-control select2">
<select id="pool_name" name="pool_name" class="form-control select2">
<option value=''>{$_L['Select_Pool']}</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label"><a href="{$_url}pool/add">{Lang::T('Expired IP Pool')}</a></label>
<div class="col-md-6">
<select id="pool_expired" name="pool_expired" class="form-control select2">
<option value=''>{$_L['Select_Pool']}</option>
</select>
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<div class="col-lg-offset-2 col-lg-10">
<button class="btn btn-primary waves-effect waves-light" type="submit">{$_L['Save']}</button>
Or <a href="{$_url}services/pppoe">{$_L['Cancel']}</a>
</div>

View File

@ -25,7 +25,7 @@
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label"><a href="{$_url}bandwidth/add">{$_L['BW_Name']}</a></label>
<label class="col-md-2 control-label">{$_L['BW_Name']}</label>
<div class="col-md-6">
<select id="id_bw" name="id_bw" class="form-control select2">
{foreach $b as $bs}
@ -58,22 +58,11 @@
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label"><a href="{$_url}pool/add">{$_L['Pool']}</a></label>
<label class="col-md-2 control-label">{$_L['Pool']}</label>
<div class="col-md-6">
<select id="pool_name" name="pool_name" required class="form-control select2">
<select id="pool_name" name="pool_name" class="form-control select2">
{foreach $p as $ps}
<option value="{$ps['pool_name']}" {if $d['pool'] eq $ps['pool_name']} selected {/if}>{$ps['pool_name']}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label"><a href="{$_url}pool/add">{Lang::T('Expired IP Pool')}</a></label>
<div class="col-md-6">
<select id="pool_expired" name="pool_expired" class="form-control select2">
<option value=''>{$_L['Select_Pool']}</option>
{foreach $p as $ps}
<option value="{$ps['pool_name']}" {if $d['pool_expired'] eq $ps['pool_name']} selected {/if}>{$ps['pool_name']}</option>
<option value="{$ps['pool_name']}" {if $d['pool_name'] eq $ps['pool_name']} selected {/if}>{$ps['pool_name']}</option>
{/foreach}
</select>
</div>

View File

@ -32,7 +32,6 @@
<th>{$_L['Plan_Price']}</th>
<th>{$_L['Plan_Validity']}</th>
<th>{$_L['Pool']}</th>
<th>{Lang::T('Expired IP Pool')}</th>
<th>{$_L['Routers']}</th>
<th>{$_L['Manage']}</th>
</tr>
@ -45,7 +44,6 @@
<td>{Lang::moneyFormat($ds['price'])}</td>
<td>{$ds['validity']} {$ds['validity_unit']}</td>
<td>{$ds['pool']}</td>
<td>{$ds['pool_expired']}</td>
<td>{$ds['routers']}</td>
<td>
<a href="{$_url}services/pppoe-edit/{$ds['id']}" class="btn btn-info btn-xs">{$_L['Edit']}</a>

View File

@ -3,62 +3,57 @@
<div class="row">
<div class="col-sm-12">
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">{$_L['Recharge_Account']}</h3>
</div>
<div class="panel-heading"><h3 class="panel-title">{$_L['Recharge_Account']}</h3></div>
<div class="panel-body">
<form class="form-horizontal" method="post" role="form" action="{$_url}prepaid/edit-post">
<input type="hidden" name="id" value="{$d['id']}">
<input type="hidden" name="id" value="{$d['id']}">
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Select_Account']}</label>
<div class="col-md-6">
<input type="text" class="form-control" id="username" name="username"
value="{$d['username']}" readonly>
</div>
<label class="col-md-2 control-label">{$_L['Select_Account']}</label>
<div class="col-md-6">
<input type="text" class="form-control" id="username" name="username" value="{$d['username']}" readonly>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Service_Plan']}</label>
<div class="col-md-6">
<select id="id_plan" name="id_plan" class="form-control select2">
<label class="col-md-2 control-label">{$_L['Service_Plan']}</label>
<div class="col-md-6">
<select id="id_plan" name="id_plan" class="form-control select2">
{foreach $p as $ps}
<option value="{$ps['id']}" {if $d['plan_id'] eq $ps['id']} selected {/if}>
{$ps['name_plan']}</option>
<option value="{$ps['id']}" {if $d['plan_id'] eq $ps['id']} selected {/if}>{$ps['name_plan']}</option>
{/foreach}
</select>
</div>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Created_On']}</label>
<div class="col-md-6">
<input type="date" class="form-control" id="recharged_on" name="recharged_on" readonly
value="{$d['recharged_on']} {$d['recharged_time']}">
</div>
<label class="col-md-2 control-label">{$_L['Created_On']}</label>
<div class="col-md-6">
<div class="input-group date" id="datepicker1">
<input type="text" class="form-control" id="recharged_on" name="recharged_on" value="{$d['recharged_on']}">
<span class="input-group-addon ion ion-calendar"></span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Expires_On']}</label>
<div class="col-md-4">
<input type="date" class="form-control" id="expiration" name="expiration"
value="{$d['expiration']}">
</div>
<div class="col-md-2">
<input type="text" class="form-control" id="time" name="time" placeholder="00:00:00"
value="{$d['time']}">
</div>
<label class="col-md-2 control-label">{$_L['Expires_On']}</label>
<div class="col-md-6">
<div class="input-group date" id="datepicker2">
<input type="text" class="form-control" id="expiration" name="expiration" value="{$d['expiration']}">
<span class="input-group-addon ion ion-calendar"></span>
</div>
</div>
</div>
<div class="form-group">
<div class="col-lg-offset-2 col-lg-10">
<button class="btn btn-success waves-effect waves-light"
type="submit">{$_L['Edit']}</button>
Or <a href="{$_url}prepaid/list">{$_L['Cancel']}</a>
</div>
</div>
<div class="form-group">
<div class="col-lg-offset-2 col-lg-10">
<button class="btn btn-success waves-effect waves-light" type="submit">{$_L['Edit']}</button>
Or <a href="{$_url}prepaid/list">{$_L['Cancel']}</a>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
{include file="sections/footer.tpl"}
{include file="sections/footer.tpl"}

View File

@ -1,70 +1,66 @@
{include file="sections/header.tpl"}
<div class="row">
<div class="col-sm-12">
<div class="panel panel-hovered mb20 panel-primary">
<div class="panel-heading">{$_L['Prepaid_User']}</div>
<div class="panel-body">
<div class="md-whiteframe-z1 mb20 text-center" style="padding: 15px">
<div class="col-md-8">
<form id="site-search" method="post" action="{$_url}prepaid/list/">
<div class="input-group">
<div class="input-group-addon">
<span class="fa fa-search"></span>
</div>
<input type="text" name="username" class="form-control"
placeholder="{$_L['Search_by_Username']}..." value="{$cari}">
<div class="input-group-btn">
<button class="btn btn-success" type="submit">{$_L['Search']}</button>
</div>
</div>
</form>
</div>
<div class="col-md-4">
<a href="{$_url}prepaid/recharge" class="btn btn-primary btn-block waves-effect"><i
class="ion ion-android-add"> </i> {$_L['Recharge_Account']}</a>
</div>&nbsp;
</div>
<div class="table-responsive">
<table id="datatable" class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>{$_L['Username']}</th>
<th>{$_L['Plan_Name']}</th>
<th>{$_L['Type']}</th>
<th>{$_L['Created_On']}</th>
<th>{$_L['Expires_On']}</th>
<th>{$_L['Method']}</th>
<th>{$_L['Routers']}</th>
<th>{$_L['Manage']}</th>
</tr>
</thead>
<tbody>
{foreach $d as $ds}
<tr>
<td><a href="{$_url}customers/viewu/{$ds['username']}">{$ds['username']}</a></td>
<td>{$ds['namebp']}</td>
<td>{$ds['type']}</td>
<td>{Lang::dateAndTimeFormat($ds['recharged_on'],$ds['recharged_time'])}</td>
<td>{Lang::dateAndTimeFormat($ds['expiration'],$ds['time'])}</td>
<td>{$ds['method']}</td>
<td>{$ds['routers']}</td>
<td>
<a href="{$_url}prepaid/edit/{$ds['id']}"
class="btn btn-warning btn-xs">{$_L['Edit']}</a>
<a href="{$_url}prepaid/delete/{$ds['id']}" id="{$ds['id']}"
class="btn btn-danger btn-xs">{$_L['Delete']}</a>
</td>
</tr>
{/foreach}
</tbody>
</table>
</div>
{$paginator['contents']}
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<div class="panel panel-hovered mb20 panel-primary">
<div class="panel-heading">{$_L['Prepaid_User']}</div>
<div class="panel-body">
<div class="md-whiteframe-z1 mb20 text-center" style="padding: 15px">
<div class="col-md-8">
<form id="site-search" method="post" action="{$_url}prepaid/list/">
<div class="input-group">
<div class="input-group-addon">
<span class="fa fa-search"></span>
</div>
<input type="text" name="username" class="form-control" placeholder="{$_L['Search_by_Username']}..." value="{$cari}">
<div class="input-group-btn">
<button class="btn btn-success" type="submit">{$_L['Search']}</button>
</div>
</div>
</form>
</div>
<div class="col-md-4">
<a href="{$_url}prepaid/recharge" class="btn btn-primary btn-block waves-effect"><i class="ion ion-android-add"> </i> {$_L['Recharge_Account']}</a>
</div>&nbsp;
</div>
<div class="table-responsive">
<table id="datatable" class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>{$_L['Username']}</th>
<th>{$_L['Plan_Name']}</th>
<th>{$_L['Type']}</th>
<th>{$_L['Created_On']}</th>
<th>{$_L['Expires_On']}</th>
<th>{$_L['Method']}</th>
<th>{$_L['Routers']}</th>
<th>{$_L['Manage']}</th>
</tr>
</thead>
<tbody>
{foreach $d as $ds}
<tr>
<td>{$ds['username']}</td>
<td>{$ds['namebp']}</td>
<td>{$ds['type']}</td>
<td>{$ds['recharged_on']}</td>
<td>{$ds['expiration']} {$ds['time']}</td>
<td>{$ds['method']}</td>
<td>{$ds['routers']}</td>
<td>
<a href="{$_url}prepaid/edit/{$ds['id']}" class="btn btn-warning btn-xs">{$_L['Edit']}</a>
<a href="{$_url}prepaid/delete/{$ds['id']}" id="{$ds['id']}" class="btn btn-danger btn-xs">{$_L['Delete']}</a>
</td>
</tr>
{/foreach}
</tbody>
</table>
</div>
{$paginator['contents']}
</div>
</div>
</div>
</div>
{include file="sections/footer.tpl"}
{include file="sections/footer.tpl"}

View File

@ -39,8 +39,8 @@
<td class="text-center">{$ds['plan_name']}</td>
<td class="text-center">{$ds['type']}</td>
<td class="text-right">{Lang::moneyFormat($ds['price'])}</td>
<td>{Lang::dateAndTimeFormat($ds['recharged_on'],$ds['recharged_time'])}</td>
<td>{Lang::dateAndTimeFormat($ds['expiration'],$ds['time'])}</td>
<td>{date($_c['date_format'], strtotime($ds['recharged_on']))}</td>
<td>{date($_c['date_format'], strtotime($ds['expiration']))} {$ds['time']}</td>
<td class="text-center">{$ds['method']}</td>
<td class="text-center">{$ds['routers']}</td>
</tr>

View File

@ -39,8 +39,8 @@
<td class="text-center">{$ds['plan_name']}</td>
<td class="text-center">{$ds['type']}</td>
<td class="text-right">{Lang::moneyFormat($ds['price'])}</td>
<td>{Lang::dateAndTimeFormat($ds['recharged_on'],$ds['recharged_time'])}</td>
<td>{Lang::dateAndTimeFormat($ds['expiration'],$ds['time'])}</td>
<td>{date($_c['date_format'], strtotime($ds['recharged_on']))}</td>
<td>{date($_c['date_format'], strtotime($ds['expiration']))} {$ds['time']}</td>
<td class="text-center">{$ds['method']}</td>
<td class="text-center">{$ds['routers']}</td>
</tr>

View File

@ -10,6 +10,10 @@
<label class="col-md-2 control-label">{$_L['Select_Account']}</label>
<div class="col-md-6">
<select id="personSelect" class="form-control select2" name="id_customer" style="width: 100%" data-placeholder="{$_L['Select_Customer']}...">
<option></option>
{foreach $c as $cs}
<option value="{$cs['id']}">{$cs['username']}</option>
{/foreach}
</select>
</div>
</div>

View File

@ -9,8 +9,12 @@
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Select_Account']}</label>
<div class="col-md-6">
<select id="personSelect" class="form-control select2" name="id_customer"
style="width: 100%" data-placeholder="{$_L['Select_Customer']}...">
<select id="personSelect" class="form-control select2" name="id_customer" style="width: 100%"
data-placeholder="{$_L['Select_Customer']}...">
<option></option>
{foreach $c as $cs}
<option value="{$cs['id']}">{$cs['username']}</option>
{/foreach}
</select>
</div>
</div>
@ -35,5 +39,4 @@
</div>
</div>
{include file="sections/footer.tpl"}

View File

@ -42,8 +42,8 @@
<td>{$ds['type']}</td>
<td>{$ds['plan_name']}</td>
<td class="text-right">{Lang::moneyFormat($ds['price'])}</td>
<td>{Lang::dateAndTimeFormat($ds['recharged_on'],$ds['recharged_time'])}</td>
<td>{Lang::dateAndTimeFormat($ds['expiration'],$ds['time'])}</td>
<td>{date($_c['date_format'], strtotime($ds['recharged_on']))}</td>
<td>{date($_c['date_format'], strtotime($ds['expiration']))} {$ds['time']}</td>
<td>{$ds['method']}</td>
<td>{$ds['routers']}</td>
</tr>

View File

@ -53,8 +53,8 @@
<td>{$ds['type']}</td>
<td>{$ds['plan_name']}</td>
<td class="text-right">{Lang::moneyFormat($ds['price'])}</td>
<td>{Lang::dateAndTimeFormat($ds['recharged_on'],$ds['recharged_time'])}</td>
<td>{Lang::dateAndTimeFormat($ds['expiration'],$ds['time'])}</td>
<td>{date($_c['date_format'], strtotime($ds['recharged_on']))}</td>
<td>{date($_c['date_format'], strtotime($ds['expiration']))} {$ds['time']}</td>
<td>{$ds['method']}</td>
<td>{$ds['routers']}</td>
</tr>

View File

@ -10,13 +10,19 @@
<div class="form-group">
<label class="col-md-3 control-label">{$_L['From_Date']}</label>
<div class="col-md-9">
<input type="date" class="form-control" value="{$tdate}" name="fdate" id="fdate">
<div class="input-group" id="datepicker1">
<input type="date" class="form-control" value="{$tdate}" name="fdate" id="fdate">
<span class="input-group-addon"><i class=" ion ion-calendar"></i></span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">{$_L['To_Date']}</label>
<div class="col-md-9">
<input type="date" class="form-control" value="{$mdate}" name="tdate" id="tdate">
<div class="input-group date" id="datepicker2">
<input type="date" class="form-control" value="{$mdate}" name="tdate" id="tdate">
<span class="input-group-addon"><i class=" ion ion-calendar"></i></span>
</div>
</div>
</div>
<div class="form-group">
@ -26,7 +32,6 @@
<option value="" selected="">{$_L['All_Transactions']}</option>
<option value="Hotspot">Hotspot</option>
<option value="PPPOE">PPPOE</option>
<option value="Balance">Balance</option>
</select>
</div>
</div>

View File

@ -1,59 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>Router Error - PHPNuxBill</title>
<link rel="shortcut icon" href="ui/ui/images/logo.png" type="image/x-icon" />
<link rel="stylesheet" href="ui/ui/styles/bootstrap.min.css">
<link rel="stylesheet" href="ui/ui/fonts/ionicons/css/ionicons.min.css">
<link rel="stylesheet" href="ui/ui/fonts/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="ui/ui/fonts/MaterialDesign/css/materialdesignicons.min.css">
<link rel="stylesheet" href="ui/ui/styles/adminlte.min.css">
<link rel="stylesheet" href="ui/ui/styles/skin-blue.min.css">
<style>
::-moz-selection {
/* Code for Firefox */
color: red;
background: yellow;
}
::selection {
color: red;
background: yellow;
}
</style>
</head>
<body class="hold-transition skin-blue">
<div class="container">
<section class="content-header">
<h1 class="text-center">
Router Error
</h1>
</section>
<section class="content">
<div class="row">
<div class="col-md-3"></div>
<div class="col-md-6">
<div class="alert alert-danger text-center">
{$error_meesage}
</div>
<a href="javascript::history.back()" onclick="history.back()" class="btn btn-warning btn-block">back</a>
</div>
</div>
</section>
<footer class="footer text-center">
PHPNuxBill by <a href="https://github.com/hotspotbilling/phpnuxbill" rel="nofollow noreferrer noopener"
target="_blank">iBNuX</a>
</footer>
</div>
</body>
</html>

View File

@ -41,8 +41,7 @@
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Router_Secret']}</label>
<div class="col-md-6">
<input type="password" class="form-control" id="password" name="password" value="{$d['password']}" onmouseleave="this.type = 'password'"
onmouseenter="this.type = 'text'">
<input type="text" class="form-control" id="password" name="password" value="{$d['password']}">
</div>
</div>
<div class="form-group">

View File

@ -14,7 +14,7 @@ $(document).ready(function () {
$('#TimeLimit').show();
$('#DataLimit').show();
}
if ($('#Unlimited').is(':checked')) {
$('#Type').hide();
$('#TimeLimit').hide();
@ -26,12 +26,12 @@ $(document).ready(function () {
if ($('#Hotspot').is(':checked')) {
$('#p').hide();
$('#h').show();
}
}
if ($('#PPPOE').is(':checked')) {
$('#p').show();
$('#h').hide();
}
});
});
$("#Hotspot").prop("checked", true).change();
@ -48,7 +48,6 @@ $(document).ready(function(){
cache: false,
success: function(msg){
$("#pool_name").html(msg);
$("#pool_expired").html(msg);
}
});
});
@ -63,10 +62,10 @@ $(function() {
dataType: "html",
url: "index.php?_route=autoload/server",
success: function(msg){
$("#server").html(msg);
$("#server").html(msg);
}
});
$("#server").change(getAjaxAlamat);
function getAjaxAlamat(){
var server = $("#server").val();

2
ui/ui/scripts/select2.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -11,8 +11,10 @@
<script src="ui/ui/scripts/jquery.min.js"></script>
<script src="ui/ui/scripts/bootstrap.min.js"></script>
<script src="ui/ui/scripts/adminlte.min.js"></script>
<script src="ui/ui/scripts/plugins/select2.min.js"></script>
<script src="ui/ui/scripts/custom.js"></script>
<script src="ui/ui/scripts/select2.min.js"></script>
{if isset($xfooter)}
{$xfooter}

View File

@ -0,0 +1,281 @@
.select2-container {
box-sizing: border-box;
display: block;
margin: 0;
position: relative;
}
.select2-container .select2-selection--single {
box-sizing: border-box;
cursor: pointer;
display: block;
height: 36px;
padding: 0 5px;
user-select: none;
-webkit-user-select: none; }
.select2-container .select2-selection--single .select2-selection__rendered {
display: block;
padding-left: 8px;
padding-right: 20px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap; }
.select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered {
padding-right: 8px;
padding-left: 20px; }
.select2-container .select2-selection--multiple {
cursor: pointer;
display: block;
user-select: none;
-webkit-user-select: none; }
.select2-container .select2-selection--multiple .select2-selection__rendered {
display: inline-block;
overflow: hidden;
padding-left: 8px;
text-overflow: ellipsis;
white-space: nowrap; }
.select2-container .select2-search--inline {
float: left; }
.select2-container .select2-search--inline .select2-search__field {
box-sizing: border-box;
border: none;
font-size: 100%;
margin-top: 5px; }
.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button {
-webkit-appearance: none; }
.select2-dropdown {
background-color: white;
border-radius: 0 0 2px 2px;
border: 1px solid #dedede;
box-sizing: border-box;
display: block;
position: absolute;
left: -100000px;
width: 100%;
z-index: 1051; }
.select2-results {
display: block; }
.select2-results__options {
list-style: none;
margin: 0;
padding: 0; }
.select2-results__option {
padding: 6px 10px;
user-select: none;
-webkit-user-select: none; }
.select2-results__option[aria-selected] {
cursor: pointer; }
.select2-container--open .select2-dropdown {
left: 0;
border-top: 0;
box-shadow: 0 1px 0 rgba(0,0,0,.05);
}
.select2-container--open .select2-dropdown--above {
border-bottom: none;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0; }
.select2-container--open .select2-dropdown--below {
border-top: none;
border-top-left-radius: 0;
border-top-right-radius: 0; }
.select2-search--dropdown {
display: block;
padding: 4px; }
.select2-search--dropdown .select2-search__field {
padding: 4px;
width: 100%;
box-sizing: border-box; }
.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button {
-webkit-appearance: none; }
.select2-search--dropdown.select2-search--hide {
display: none; }
.select2-close-mask {
border: 0;
margin: 0;
padding: 0;
display: block;
position: fixed;
left: 0;
top: 0;
min-height: 100%;
min-width: 100%;
height: auto;
width: auto;
opacity: 0;
z-index: 99;
background-color: #fff;
filter: alpha(opacity=0); }
.select2-hidden-accessible {
border: 0;
clip: rect(0 0 0 0);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
width: 1px; }
/*** Default Style ***/
.select2-container--default .select2-selection--single {
background-color: #fff;
border: 1px solid #dedede;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
border-radius:0px; }
.select2-container--default .select2-selection--single .select2-selection__rendered {
color: #333;
line-height: 36px;}
.select2-container--default .select2-selection--single .select2-selection__clear {
cursor: pointer;
float: right;
font-weight: bold; }
.select2-container--default .select2-selection--single .select2-selection__placeholder {
color: #999; }
.select2-container--default .select2-selection--single .select2-selection__arrow {
height: 26px;
position: absolute;
top: 5px;
right: 4px;
width: 20px; }
.select2-container--default .select2-selection--single .select2-selection__arrow b {
border-color: #555 transparent transparent transparent;
border-style: solid;
border-width: 5px 4px 0 4px;
height: 0;
left: 50%;
margin-left: -4px;
margin-top: -2px;
position: absolute;
top: 50%;
width: 0; }
.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__clear {
float: left; }
.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__arrow {
left: 1px;
right: auto; }
.select2-container--default.select2-container--disabled .select2-selection--single {
background-color: #eee;
cursor: default; }
.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear {
display: none; }
.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
border-color: transparent transparent #888 transparent;
border-width: 0 4px 5px 4px; }
.select2-container--default .select2-selection--multiple {
background-color: #fff;
height: 36px;
border: none;
border-bottom: 1px solid #dedede;
cursor: text; }
.select2-container--default .select2-selection--multiple .select2-selection__rendered {
list-style: none;
margin: 0;
min-height: 36px;
padding: 0 5px;
margin-bottom: 0;
width: 100%; }
.select2-container--default .select2-selection--multiple .select2-selection__placeholder {
color: #999;
margin-top: 5px;
float: left; }
.select2-container--default .select2-selection--multiple .select2-selection__clear {
cursor: pointer;
float: right;
font-weight: bold;
margin-top: 5px;
margin-right: 10px; }
.select2-container--default .select2-selection--multiple .select2-selection__choice {
background-color: #fff;
border: 1px solid #dedede;
border-radius: 1px;
cursor: default;
float: left;
font-size: 12px;
margin-right: 5px;
margin-top: 4px;
position: relative;
top: 1px;
box-shadow: 0 1px 1px rgba(0,0,0,.1);
padding: 2px 8px; }
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
color: #999;
cursor: pointer;
display: inline-block;
font-weight: bold;
margin-right: 2px; }
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
color: #333; }
.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice, .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__placeholder {
float: right; }
.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
margin-left: 5px;
margin-right: auto; }
.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove {
margin-left: 2px;
margin-right: auto; }
.select2-container--default.select2-container--focus .select2-selection--multiple {
border: none;
border-bottom: solid #dedede 1px;
outline: 0; }
.select2-container--default.select2-container--disabled .select2-selection--multiple {
background-color: #eee;
cursor: default; }
.select2-container--default.select2-container--disabled .select2-selection__choice__remove {
display: none; }
.select2-container--default.select2-container--open.select2-container--above .select2-selection--single, .select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple {
border-top-left-radius: 0;
border-top-right-radius: 0; }
.select2-container--default.select2-container--open.select2-container--below .select2-selection--single, .select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple {
border-bottom-left-radius: 0;
border-bottom-right-radius: 0; }
.select2-container--default .select2-search--dropdown .select2-search__field {
border: 1px solid #eee; }
.select2-container--default .select2-search--inline .select2-search__field {
background: transparent;
border: none;
outline: 0; }
.select2-container--default .select2-results > .select2-results__options {
max-height: 200px;
overflow-y: auto; }
.select2-container--default .select2-results__option[role=group] {
padding: 0; }
.select2-container--default .select2-results__option[aria-disabled=true] {
color: #999; }
.select2-container--default .select2-results__option[aria-selected=true] {
background-color: transparent; }
.select2-container--default .select2-results__option .select2-results__option {
padding-left: 1em; }
.select2-container--default .select2-results__option .select2-results__option .select2-results__group {
padding-left: 0; }
.select2-container--default .select2-results__option .select2-results__option .select2-results__option {
margin-left: -1em;
padding-left: 2em; }
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
margin-left: -2em;
padding-left: 3em; }
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
margin-left: -3em;
padding-left: 4em; }
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
margin-left: -4em;
padding-left: 5em; }
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
margin-left: -5em;
padding-left: 6em; }
.select2-container--default .select2-results__option--highlighted[aria-selected] {
background-color:#3f51b5;
color: white; }
.select2-container--default .select2-results__group {
cursor: default;
display: block;
padding: 6px; }

View File

@ -26,8 +26,9 @@
<td>{$ds['plan_name']}</td>
<td>{Lang::moneyFormat($ds['price'])}</td>
<td>{$ds['type']}</td>
<td>{Lang::dateAndTimeFormat($ds['recharged_on'],$ds['recharged_time'])}</td>
<td>{Lang::dateAndTimeFormat($ds['expiration'],$ds['time'])}</td>
<td class="text-success">{date($_c['date_format'], strtotime($ds['recharged_on']))}</td>
<td class="text-danger">{date($_c['date_format'], strtotime($ds['expiration']))}
{$ds['time']}</td>
<td>{$ds['method']}</td>
</tr>
{/foreach}

View File

@ -12,7 +12,8 @@
<tbody>
<tr>
<td>{Lang::T('expired')}</td>
<td>{Lang::dateTimeFormat($unpaid['expired_date'])} </td>
<td>{date({$_c['date_format']}, strtotime($unpaid['expired_date']))}
{date('H:i', strtotime($unpaid['expired_date']))} </td>
</tr>
<tr>
<td>{$_L['Plan_Name']}</td>
@ -29,22 +30,10 @@
</tbody>
</table>
<div class="box-footer p-2">
<div class="btn-group btn-group-justified mb15">
<div class="btn-group">
<a href="{$_url}order/view/{$unpaid['id']}/cancel" class="btn btn-danger btn-sm"
onclick="return confirm('{Lang::T('Cancel it?')}')">
<span class="glyphicon glyphicon-trash"></span>
{Lang::T('Cancel')}
</a>
</div>
<div class="btn-group">
<a class="btn btn-success btn-block btn-sm" href="{$_url}order/view/{$unpaid['id']}">
<span class="icon"><i class="ion ion-card"></i></span>
<span>{Lang::T('PAY NOW')}</span>
</a>
</div>
</div>
<a class="btn btn-danger btn-block btn-sm" href="{$_url}order/view/{$unpaid['id']}">
<span class="icon"><i class="ion ion-card"></i></span>
<span>{Lang::T('PAY NOW')}</span>
</a>
</div>
</div>
{/if}
@ -52,7 +41,7 @@
<div class="box-header">
<h3 class="box-title">{$_L['Announcement']}</h3>
</div>
<div class="box-body">
<div class="box-body" style="max-height:296px;overflow:auto;">
{include file="$_path/../pages/Announcement.html"}
</div>
</div>
@ -65,7 +54,7 @@
<table class="table table-bordered table-striped table-bordered table-hover">
<tr>
<td class="small text-success text-uppercase text-normal">{$_L['Username']}</td>
<td class="small mb15">{$_user['username']}</td>
<td class="small mb15">{$_bill['username']}</td>
</tr>
<tr>
<td class="small text-success text-uppercase text-normal">{$_L['Password']}</td>
@ -95,14 +84,14 @@
<tr>
<td class="small text-info text-uppercase text-normal">{$_L['Created_On']}</td>
<td class="small mb15">
{if $_bill['time'] ne ''}{Lang::dateAndTimeFormat($_bill['recharged_on'],$_bill['recharged_time'])}
{if $_bill['time'] ne ''}{date($_c['date_format'], strtotime($_bill['recharged_on']))}
{/if}&nbsp;</td>
</tr>
<tr>
<td class="small text-danger text-uppercase text-normal">{$_L['Expires_On']}</td>
<td class="small mb15">
{if $_bill['time'] ne ''}{Lang::dateAndTimeFormat($_bill['expiration'],$_bill['time'])}{/if}&nbsp;
</td>
{if $_bill['time'] ne ''}{date($_c['date_format'], strtotime($_bill['expiration']))}
{$_bill['time']}{/if}&nbsp;</td>
</tr>
{if $_bill['type'] == 'Hotspot' && $_bill['status'] == 'on'}
{if $nux_ip}
@ -149,42 +138,6 @@
}, 2000);
</script>
{/if}
{if $_c['enable_balance'] == 'yes' && $_c['allow_balance_transfer'] == 'yes'}
<div class="box box-primary box-solid mb30">
<div class="box-header">
<h4 class="box-title">{Lang::T("Transfer Balance")}</h4>
</div>
<div class="box-body p-0">
<form method="post" onsubmit="return askConfirm()" role="form" action="{$_url}home">
<div class="form-group">
<div class="col-sm-5">
<input type="text" id="username" name="username" class="form-control" required
placeholder="{$_L['Username']}">
</div>
<div class="col-sm-5">
<input type="number" id="balance" name="balance" autocomplete="off" class="form-control"
required placeholder="{$_L['Balance']}">
</div>
<div class="form-group col-sm-2" align="center">
<button class="btn btn-success btn-block" id="sendBtn" type="submit" name="send"
value="balance"><i class="glyphicon glyphicon-send"></i></button>
</div>
</div>
</form>
<script>
function askConfirm() {
if(confirm('{Lang::T('Send your balance?')}')){
setTimeout(() => {
document.getElementById('sendBtn').setAttribute('disabled', '');
}, 1000);
return true;
}
return false;
}
</script>
</div>
</div>
{/if}
<br>
{if $_c['disable_voucher'] != 'yes'}
<div class="box box-primary box-solid mb30">

View File

@ -70,10 +70,10 @@
</div>
<div class="btn-group btn-group-justified mb15">
<div class="btn-group">
<a href="{$_url}register" class="btn btn-success">{$_L['Register']}</a>
<button type="submit" class="btn btn-primary">{$_L['Login']}</button>
</div>
<div class="btn-group">
<button type="submit" class="btn btn-primary">{$_L['Login']}</button>
<a href="{$_url}register" class="btn btn-success">{$_L['Register']}</a>
</div>
</div>
</form>

View File

@ -33,10 +33,6 @@
{/foreach}
</div>
</div>
<div class="box box-solid box-success">
<div class="box-header text-center text-bold">{Lang::T('Balance')} {Lang::moneyFormat($_user['balance'])}</div>
</div>
{/if}
{foreach $routers as $router}
<div class="box box-solid box-info">
@ -73,16 +69,9 @@
</table>
</div>
<div class="box-body">
<div class="btn-group btn-group-justified" role="group" aria-label="...">
<a href="{$_url}order/buy/{$router['id']}/{$plan['id']}"
onclick="return confirm('{Lang::T('Buy this? your active package will be overwrite')}')"
class="btn btn-sm btn-block btn-warning text-black">Buy</a>
{if $_c['enable_balance'] == 'yes' && $_user['balance']>=$plan['price']}
<a href="{$_url}order/pay/{$router['id']}/{$plan['id']}"
onclick="return confirm('{Lang::T('Pay this with Balance? your active package will be overwrite')}')"
class="btn btn-sm btn-block btn-success">{Lang::T('Pay With Balance')}</a>
{/if}
</div>
<a href="{$_url}order/buy/{$router['id']}/{$plan['id']}"
onclick="return confirm('{Lang::T('Buy this? your active package will be overwrite')}')"
class="btn btn-sm btn-block btn-primary">Buy</a>
</div>
</div>
</div>
@ -117,16 +106,9 @@
</table>
</div>
<div class="box-body">
<div class="btn-group btn-group-justified" role="group" aria-label="...">
<a href="{$_url}order/buy/{$router['id']}/{$plan['id']}"
onclick="return confirm('{Lang::T('Buy this? your active package will be overwrite')}')"
class="btn btn-sm btn-block btn-warning text-black">Buy</a>
{if $_c['enable_balance'] == 'yes' && $_user['balance']>=$plan['price']}
<a href="{$_url}order/pay/{$router['id']}/{$plan['id']}"
onclick="return confirm('{Lang::T('Pay this with Balance? your active package will be overwrite')}')"
class="btn btn-sm btn-block btn-success">{Lang::T('Pay With Balance')}</a>
{/if}
</div>
<a href="{$_url}order/buy/{$router['id']}/{$plan['id']}"
onclick="return confirm('{Lang::T('Buy this? your active package will be overwrite')}')"
class="btn btn-sm btn-block btn-primary">Buy</a>
</div>
</div>
</div>

View File

@ -6,7 +6,7 @@
<div
class="panel mb20 {if $trx['status']==1}panel-warning{elseif $trx['status']==2}panel-success{elseif $trx['status']==3}panel-danger{elseif $trx['status']==4}panel-danger{else}panel-primary{/if} panel-hovered">
<div class="panel-footer">Transaction #{$trx['id']}</div>
{if $trx['routers']!='balance'}
{if $plan['type']!='Balance'}
<div class="panel-body">
<div class="panel panel-primary panel-hovered">
<div class="panel-heading">{$router['name']}</div>
@ -17,98 +17,70 @@
</div>
{/if}
<div class="table-responsive">
{if $trx['pg_url_payment']=='balance'}
<table class="table table-bordered table-striped table-bordered">
<tbody>
<tr>
<td>{Lang::T('Type')}</td>
<td>{$trx['plan_name']}</td>
</tr>
<table class="table table-bordered table-striped table-bordered">
<tbody>
<tr>
<td>{Lang::T('Status')}</td>
<td>{if $trx['status']==1}{Lang::T('UNPAID')}{elseif $trx['status']==2}{Lang::T('PAID')}{elseif $trx['status']==3}{Lang::T('FAILED')}{elseif $trx['status']==4}{Lang::T('CANCELED')}{else}{Lang::T('UNKNOWN')}{/if}
</td>
</tr>
<tr>
<td>{Lang::T('expired')}</td>
<td>{date($_c['date_format'], strtotime($trx['expired_date']))}
{date('H:i', strtotime($trx['expired_date']))} </td>
</tr>
{if $trx['status']==2}
<tr>
<td>{Lang::T('Paid Date')}</td>
<td>{date($_c['date_format'], strtotime($trx['paid_date']))}
{date('H:i', strtotime($trx['paid_date']))} </td>
</tr>
<tr>
{if $trx['plan_name'] == 'Receive Balance'}
<td>{Lang::T('From')}</td>
{else}
<td>{Lang::T('To')}</td>
{/if}
<td>{$trx['gateway']}</td>
</tr>
<tr>
<td>{$_L['Balance']}</td>
<td>{Lang::moneyFormat($trx['price'])}</td>
</tr>
</tbody>
</table>
{else}
<table class="table table-bordered table-striped table-bordered">
<tbody>
<tr>
<td>{Lang::T('Status')}</td>
<td>{if $trx['status']==1}{Lang::T('UNPAID')}{elseif $trx['status']==2}{Lang::T('PAID')}{elseif $trx['status']==3}{Lang::T('FAILED')}{elseif $trx['status']==4}{Lang::T('CANCELED')}{else}{Lang::T('UNKNOWN')}{/if}
</td>
</tr>
<tr>
<td>{Lang::T('expired')}</td>
<td>{date($_c['date_format'], strtotime($trx['expired_date']))}
{date('H:i', strtotime($trx['expired_date']))} </td>
</tr>
{if $trx['status']==2}
{/if}
<tr>
<td>{$_L['Plan_Name']}</td>
<td>{$plan['name_plan']}</td>
</tr>
<tr>
<td>{$_L['Plan_Price']}</td>
<td>{Lang::moneyFormat($plan['price'])}</td>
</tr>
<tr>
<td>{Lang::T('Type')}</td>
<td>{$plan['type']}</td>
</tr>
{if $plan['type']!='Balance'}
{if $plan['type'] eq 'Hotspot'}
<tr>
<td>{Lang::T('Paid Date')}</td>
<td>{date($_c['date_format'], strtotime($trx['paid_date']))}
{date('H:i', strtotime($trx['paid_date']))} </td>
<td>{Lang::T('Plan_Type')}</td>
<td>{Lang::T($plan['typebp'])}</td>
</tr>
{/if}
<tr>
<td>{$_L['Plan_Name']}</td>
<td>{$plan['name_plan']}</td>
</tr>
<tr>
<td>{$_L['Plan_Price']}</td>
<td>{Lang::moneyFormat($plan['price'])}</td>
</tr>
<tr>
<td>{Lang::T('Type')}</td>
<td>{$plan['type']}</td>
</tr>
{if $plan['type']!='Balance'}
{if $plan['type'] eq 'Hotspot'}
<tr>
<td>{Lang::T('Plan_Type')}</td>
<td>{Lang::T($plan['typebp'])}</td>
</tr>
{if $plan['typebp'] eq 'Limited'}
{if $plan['limit_type'] eq 'Time_Limit' or $plan['limit_type'] eq 'Both_Limit'}
<tr>
<td>{Lang::T('Time_Limit')}</td>
<td>{$ds['time_limit']} {$ds['time_unit']}</td>
</tr>
{/if}
{if $plan['limit_type'] eq 'Data_Limit' or $plan['limit_type'] eq 'Both_Limit'}
<tr>
<td>{Lang::T('Data_Limit')}</td>
<td>{$ds['data_limit']} {$ds['data_unit']}</td>
</tr>
{/if}
{if $plan['typebp'] eq 'Limited'}
{if $plan['limit_type'] eq 'Time_Limit' or $plan['limit_type'] eq 'Both_Limit'}
<tr>
<td>{Lang::T('Time_Limit')}</td>
<td>{$ds['time_limit']} {$ds['time_unit']}</td>
</tr>
{/if}
{if $plan['limit_type'] eq 'Data_Limit' or $plan['limit_type'] eq 'Both_Limit'}
<tr>
<td>{Lang::T('Data_Limit')}</td>
<td>{$ds['data_limit']} {$ds['data_unit']}</td>
</tr>
{/if}
{/if}
<tr>
<td>{$_L['Plan_Validity']}</td>
<td>{$plan['validity']} {$plan['validity_unit']}</td>
</tr>
<tr>
<td>{$_L['Bandwidth_Plans']}</td>
<td>{$bandw['name_bw']}<br>{$bandw['rate_down']}{$bandw['rate_down_unit']}/{$bandw['rate_up']}{$bandw['rate_up_unit']}
</td>
</tr>
{/if}
</tbody>
</table>
{/if}
<tr>
<td>{$_L['Plan_Validity']}</td>
<td>{$plan['validity']} {$plan['validity_unit']}</td>
</tr>
<tr>
<td>{$_L['Bandwidth_Plans']}</td>
<td>{$bandw['name_bw']}<br>{$bandw['rate_down']}{$bandw['rate_down_unit']}/{$bandw['rate_up']}{$bandw['rate_up_unit']}
</td>
</tr>
{/if}
</tbody>
</table>
</div>
{if $trx['status']==1}
<div class="panel-footer ">

View File

@ -208,7 +208,7 @@ function deleteFolder($path)
<div class="container">
<section class="content-header">
<h1 class="text-center">
Update PHPNuxBill
Update PHP NuxBill
</h1>
</section>

View File

@ -1,3 +1,3 @@
{
"version": "2023.9.6"
"version": "2023.8.18"
}