Compare commits

...

53 Commits

Author SHA1 Message Date
b0cac9510d Merge pull request #18 from hotspotbilling/Development
Plugin Installer
2023-03-08 13:03:57 +07:00
b0542ab8be plugin manager 2023-03-08 11:08:56 +07:00
2155c3adae 2023.3.6 2023-03-06 14:57:36 +07:00
51984401d2 bold 2023-03-06 14:57:06 +07:00
fc6a5a26eb add new install 2023-03-06 14:52:09 +07:00
ec45d59a68 change sending message 2023-03-06 14:51:36 +07:00
ba85ed6d0e change text 2023-03-06 14:51:24 +07:00
41c3628eeb add new lang text 2023-03-06 14:51:13 +07:00
26be14bf0e add new lang text 2023-03-06 14:51:05 +07:00
1315621259 check notification 2023-03-06 14:50:55 +07:00
b10cfa2a8e add expired notification 2023-03-06 14:49:44 +07:00
3130310d9c add notification settings 2023-03-06 14:49:26 +07:00
6042538d8e Move send SMS/Wa/Telegram to class 2023-03-06 14:48:05 +07:00
976300bac7 Plugin Manager, install belum 2023-01-31 14:26:49 +07:00
d526ceb6bc Fix delete 2023-01-31 09:14:02 +07:00
d5f29a5c74 update readme 2022-12-14 15:57:20 +07:00
50e55744ec Merge pull request #12 from hotspotbilling/Development
Fixing some code to be able integrate with paypal payment gateway
2022-12-14 15:33:01 +07:00
b69552b44a add sponsors 2022-12-14 15:22:30 +07:00
51b5dbd6f7 Version 2022.12.14 2022-12-14 15:18:39 +07:00
ada4bc8b51 add translation 2022-12-14 15:08:49 +07:00
f3363856f3 Check user email and Desc History 2022-12-14 15:08:42 +07:00
376a3448b6 add postData 2022-12-14 15:08:23 +07:00
660f186004 WhatsappGateway Info 2022-12-14 15:08:14 +07:00
35667e9459 Fix registration info 2022-12-13 15:14:27 +07:00
4fe47612eb Merge pull request #4 from hotspotbilling/Development
rename sql
2022-11-18 14:22:01 +07:00
d777921fbd rename sql 2022-11-18 14:16:00 +07:00
fdbef99985 Merge pull request #3 from hotspotbilling/Development
Change design
2022-11-17 12:42:42 +07:00
7651697ae7 change table 2022-11-17 12:36:32 +07:00
1afa84e36f fixlogin and panel-primary 2022-10-17 11:57:39 +07:00
a2a3a7f0a6 hotspotbilling/phpnuxbill 2022-10-16 14:50:24 +07:00
a7e8335297 admin change to adminlte 2022-10-16 14:48:21 +07:00
9015d519c1 change to adminlte 2 2022-10-15 23:18:24 +07:00
98fe44d8aa tapi mau ganti ke paper admin aja 2022-10-13 15:19:51 +07:00
79c7ad1d98 bulma started 2022-10-13 14:00:54 +07:00
565f481a65 fix menu ? 2022-10-12 16:51:29 +07:00
658aa73540 add random anti cache 2022-10-10 10:50:13 +07:00
d7bdec6f29 check version 2022-10-10 10:49:01 +07:00
4f300df828 version file 2022-10-10 10:26:05 +07:00
e477bc90cc Fix Mobile Nav not open when cliecked 2022-10-09 19:43:48 +07:00
6033901886 masuk radius 2022-10-05 10:51:18 +07:00
0ca2dc2029 update install 2022-10-04 10:06:38 +07:00
ef7d122464 update readme and install files 2022-10-04 10:06:28 +07:00
89e0dd9380 Fix Pools 2022-10-03 11:03:56 +07:00
d7d9d9efa1 $_c ke $config 2022-09-21 14:15:00 +07:00
e7e32475cc add templat dir 2022-09-19 16:57:09 +07:00
3ff2e31ccf delete payment gateway 2022-09-19 10:45:50 +07:00
d5c3c23794 payment gateway not included 2022-09-19 10:45:37 +07:00
335c5e524b move config.php and install to root 2022-09-19 09:31:35 +07:00
ac813ca132 simplified Mikrotik Connection 2022-09-18 00:52:39 +07:00
e6f8826490 add hook 2022-09-18 00:00:40 +07:00
742e0df1f2 add menu hook 2022-09-17 22:34:55 +07:00
1c63cd674c no themes 2022-09-17 21:05:24 +07:00
b943a73cb4 fix separator with DIRECTORY_SEPARATOR 2022-09-17 21:03:47 +07:00
193 changed files with 4781 additions and 20906 deletions

16
.gitignore vendored
View File

@ -1,7 +1,19 @@
system/config.php
config.php
.DS_Store
.vscode/
ui/compiled/*.php
ui/cache/*.php
test.php
pages/
pages/
system/cache/**
system/plugin/*
!system/cache/index.html
!system/plugin/index.html
system/paymentgateway/ui/**
system/paymentgateway/**
!system/paymentgateway/ui/
!system/paymentgateway/ui/index.html
!system/paymentgateway/index.html
!system/plugin/ui/
system/plugin/ui/*
!system/plugin/ui/index.html

View File

@ -1,14 +1,13 @@
# PHP Mikrotik Billing
# PHPNuxBill - Mikrotik Billing
## Feature
- Voucher Generator and Print
- Self registration, user must have voucher before registration
- Self registration
- Multi Router Mikrotik
- Hotspot & PPPOE
- Easy Installation
- Multi Language
- RADIUS
- Payment Gateway Midtrans, Xendit and Tripay
- SMS validation for login
- Whatsapp Notification to Consumer
@ -16,31 +15,24 @@
## Payment Gateway
- Tripay.com | Indonesia
- Xendit.com | Indonesia and Philippine ( Philippine not tested )
- Duitku.com | Indonesia
## Installation
- [Tripay.com](https://github.com/hotspotbilling/phpnuxbill-tripay) | Indonesia
- [Xendit.com](https://github.com/hotspotbilling/phpnuxbill-xendit) | Indonesia and Philippine ( Philippine not tested )
- [Duitku.com](https://github.com/hotspotbilling/phpnuxbill-duitku) | Indonesia
- Rename **pages_template** to **pages**
- make writeable **system** folder or create file **system/config.php** and make it writeable
- make writeable folder **ui/cache/** and **ui/compiled**
- Open webs and run installation
- set cronjobs or scheduller for **system/cron.php**
Click link to download
Radius system need to set radius to use **system/radius.php** you can ask me for paid support.
Goto Discussionif you want another Payment Gateway
See [WIKI](https://github.com/ibnux/phpmixbill/wiki/Instalation)
baca [WIKI](https://github.com/ibnux/phpmixbill/wiki/Instalation)
Some documentation
## System Requirements
Most current web servers with PHP & MySQL installed will be capable of running PHPMixBill
Most current web servers with PHP & MySQL installed will be capable of running PHPNuxBill
Minimum Requirements
- Linux or Windows OS
- PHP Version 7.0+
- PHP Version 7.2+
- Both PDO & MySQLi Support
- GD2 Image Library
- CURL support
@ -50,6 +42,66 @@ can be Installed in Raspberry Pi Device.
The problem with windows is hard to set cronjob, better Linux
## Installation
### Git Clone
clone this repository or download zip or release
1. Rename **pages_template** to **pages**
2. Rename **config.sample.php** to **config.php** and make it writeable (chmod 777)
3. make writeable folder **ui/cache/** and **ui/compiled**
4. Open web and run installation
5. set [cronjob](https://github.com/hotspotbilling/phpnuxbill/wiki/Cron-Jobs) or scheduller for **system/cron.php**
6. make **config.php** unwriteable (chmod 644)
### Composer install
Go to directory you want to install
Install Composer in your system
```bash
# Debian/Ubuntu
sudo apt install composer
# Centos/Redhat
sudo yum install composer
```
install on curent directory
```bash
composer create-project hotspotbilling/phpnuxbill .
```
install on new directory
```bash
composer create-project hotspotbilling/phpnuxbill phpnuxbill
```
## Manual Installation
1. Download project from [Master Branch](https://github.com/hotspotbilling/phpnuxbill/archive/refs/heads/master.zip) or from [Release](https://github.com/hotspotbilling/phpnuxbill/releases)
2. unzip and upload it to server
3. Rename **pages_template** to **pages**
4. Rename **config.sample.php** to **config.php** and make it writeable (chmod 777)
5. make writeable folder **ui/cache/** and **ui/compiled**
6. Open web and run installation
7. set [cronjob](https://github.com/hotspotbilling/phpnuxbill/wiki/Cron-Jobs) or scheduller for **system/cron.php**
8. make **config.php** unwriteable (chmod 644)
## UPDGRADE
for old version, below Version 6, backup **system/config.php**, delete all file except folder **pages**, upload all new files, put **config.php** in root folder (not in system folder), got to folder **/install** and run Update.
for version 6 above, just replace all files, using filezilla can choose overwrite if different file size or time.
or git pull if you use git clone
## RADIUS system
Still on development
## Paid Support
Start from Rp 500.000 or $50
@ -73,3 +125,8 @@ BCA: 5410454825
Mandiri: 163-000-1855-793
a.n Ibnu Maksum
## SPONSORS
- [mlink.id](https://mlink.id)
- [https://github.com/sonyinside](https://github.com/sonyinside)

View File

@ -1,6 +1,6 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
**/
header('location: ../index.php?_route=admin/');

16
composer.json Normal file
View File

@ -0,0 +1,16 @@
{
"name": "hotspotbilling/phpnuxbill",
"type": "template",
"description": "PHPNuxBill a Hotspot Billing Software.",
"keywords": ["template"],
"homepage": "https://github.com/hotspotbilling/phpnuxbill",
"license": "MIT",
"authors": [
{
"name": "ibnux",
"email": "me@ibnux.net",
"homepage": "https://ibnux.net",
"role": "Developer"
}
]
}

View File

@ -1,9 +1,9 @@
<?php
$db_host = "localhost"; # Database Host
$db_port = ""; # Database Port. Keep it blank if you are un sure.
$db_user = "root"; # Database Username
$db_password = ""; # Database Password
$db_name = "phpmixbill"; # Database Name
define('APP_URL', 'http://localhost/phpmixbill'); # Application URL.
#Please include http and do not use trailing slash after the url. For example use in this format- http://www.example.com Or http://www.example.com/finance
<?php
$db_host = "localhost"; # Database Host
$db_port = ""; # Database Port. Keep it blank if you are un sure.
$db_user = "root"; # Database Username
$db_password = ""; # Database Password
$db_name = "phpnuxbill"; # Database Name
define('APP_URL', 'http://localhost/phpnuxbill'); # Application URL.
#Please include http and do not use trailing slash after the url. For example use in this format- http://www.example.com Or http://www.example.com/finance
$_app_stage = 'Live'; # Do not change this

View File

@ -4,7 +4,7 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>PHPMIXBILL - Voucher management for Mikrotik Hotspot</title>
<title>PHPNUXBILL - Voucher management for Mikrotik Hotspot</title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
@ -35,28 +35,28 @@
<div class="container">
<div class="starter-template">
<h1>PHP PHPMIXBILL</h1>
<h1>PHP PHPNUXBILL</h1>
<p class="lead">Aplikasi manajemen Voucher Hotspot untuk Mikrotik</p>
<div class="btn-group btn-group-justified" role="group">
<a href="https://github.com/ibnux/phpmixbill/releases" class="btn btn-primary">Download</a>
<a href="https://github.com/ibnux/phpmixbill" class="btn btn-success">Source</a>
<a href="https://github.com/hotspotbilling/phpnuxbill/releases" class="btn btn-primary">Download</a>
<a href="https://github.com/hotspotbilling/phpnuxbill" class="btn btn-success">Source</a>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<div class="panel panel-hovered mb20 panel-default">
<div class="panel panel-hovered mb20 panel-primary">
<div class="panel-heading">Public Disquss</div>
<div class="panel-body">
<div id="disqus_thread"></div>
<script>
var disqus_config = function () {
this.page.url = "https://ibnux.github.io/phpmixbill/diskusi.html"; // Replace PAGE_URL with your page's canonical URL variable
this.page.identifier = "phpmixbill"; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
this.page.url = "https://github.com/hotspotbilling/phpnuxbill/diskusi.html"; // Replace PAGE_URL with your page's canonical URL variable
this.page.identifier = "phpnuxbill"; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
};
(function() { // DON'T EDIT BELOW THIS LINE
var d = document, s = d.createElement('script');
s.src = 'https://phpmixbill.disqus.com/embed.js';
s.src = 'https://phpnuxbill.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();

View File

@ -4,7 +4,7 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>PHPMIXBILL - Voucher management for Mikrotik Hotspot</title>
<title>PHPNUXBILL - Voucher management for Mikrotik Hotspot</title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
@ -36,12 +36,12 @@
<div class="container">
<div class="starter-template">
<h1>PHPMIXBILL</h1>
<h1>PHPNUXBILL</h1>
<p class="lead">Aplikasi manajemen Voucher Hotspot untuk Mikrotik</p>
<div class="btn-group btn-group-justified" role="group">
<a href="https://github.com/ibnux/phpmixbill/releases" class="btn btn-primary">Download</a>
<a href="https://github.com/ibnux/phpmixbill" class="btn btn-success">Source</a>
<a href="https://github.com/ibnux/phpmixbill/discussions" class="btn btn-info">Discussions</a>
<a href="https://github.com/hotspotbilling/phpnuxbill/releases" class="btn btn-primary">Download</a>
<a href="https://github.com/hotspotbilling/phpnuxbill" class="btn btn-success">Source</a>
<a href="https://github.com/hotspotbilling/phpnuxbill/discussions" class="btn btn-info">Discussions</a>
</div>
</div>

View File

@ -1,6 +1,6 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
**/
require ('system/boot.php');

View File

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

Before

Width:  |  Height:  |  Size: 8.1 KiB

After

Width:  |  Height:  |  Size: 8.1 KiB

View File

@ -1,60 +1,60 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>PHPMixBill Installer</title>
<link rel="shortcut icon" type="image/x-icon" href="img/favicon.png">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type='text/css' href='css/style.css' rel='stylesheet' />
<link href="css/bootstrap.min.css" rel="stylesheet">
</head>
<body style='background-color: #FBFBFB;'>
<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>
<!-- contents area start -->
<div class="row">
<div class="col-md-12">
<h4> PHPMixBill Installer </h4>
<h5>Please Read Before Continue</h5>
<p><strong>Informasi Aplikasi</strong><br>
Application Name: PHPMixBill <br>
Release Date: 30/10/2015<br>
By: PHPMixBill [ <a href="https://github.com/ibnux/phpmixbill" target="_blank">https://github.com/ibnux/phpmixbill</a> ]<br>
Donasi Paypal: <b>me@ibnux.et</b><br>
<br>
<strong>Syarat Penggunaan:</strong><br>
Syarat Penggunaan ini berlaku untuk semua versi.<br><br>
<ul>
<li>Silahkan Anda menggunakan aplikasi ini dengan bijak, Anda dapat mendesain ulang script maupun tampilan pada
aplikasi ini sesuai dengan kebutuhan anda, memperbayak jumlah copy atau mendistribusikan aplikasi ini.
Dengan catatan tidak menghapus link developer.</li>
<li>Tidak ada garansi dari kami jika anda mengalami error atau merasa rugi ketika menggunakan aplikasi ini,
Anda hanya dapat memberikan feedback yang berisi laporan error, dengan syarat dan ketentuan yang berlaku.</li>
<li>Semua yang terkait biaya atau donasi apapun versi-nya, Anda dapat update seumur hidup atau selama aplikasi
ini masih dikembangkan. Mohon jangan salah pengertian bahwa kami tim pengembang mengkomersilkan produk ini
dan anda membeli produk kami.</li>
<li>Aplikasi ini bersifat sosial untuk dapat dikembangkan bersama. Karena itu kami juga mengundang relawan-relawan
yang mau menjadi pengembangkan aplikasi ini.</li>
<li>Penulis berhak setiap saat untuk mengubah ketentuan Syarat Penggunaan tanpa pemberitahuan sebelumnya.</li>
</ul>
</div>
<div class="col-md-12"><br>
<a href="step2.php" class="btn btn-primary">Accept &amp; Continue</a>
</div>
</div>
<!-- contents area end -->
</div>
<div class="footer">Copyright &copy; 2021 PHPMixBill. All Rights Reserved<br /><br /></div>
</body>
<!DOCTYPE html>
<html lang="en">
<head>
<title>PHPNuxBill Installer</title>
<link rel="shortcut icon" type="image/x-icon" href="img/favicon.png">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type='text/css' href='css/style.css' rel='stylesheet' />
<link href="css/bootstrap.min.css" rel="stylesheet">
</head>
<body style='background-color: #FBFBFB;'>
<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>
<!-- contents area start -->
<div class="row">
<div class="col-md-12">
<h4> PHPNuxBill Installer </h4>
<h5>Please Read Before Continue</h5>
<p><strong>Informasi Aplikasi</strong><br>
Application Name: PHPNuxBill <br>
Release Date: 30/10/2015<br>
By: PHPNuxBill [ <a href="https://github.com/hotspotbilling/phpnuxbill" target="_blank">https://github.com/hotspotbilling/phpnuxbill</a> ]<br>
Donasi Paypal: <b>me@ibnux.et</b><br>
<br>
<strong>Syarat Penggunaan:</strong><br>
Syarat Penggunaan ini berlaku untuk semua versi.<br><br>
<ul>
<li>Silahkan Anda menggunakan aplikasi ini dengan bijak, Anda dapat mendesain ulang script maupun tampilan pada
aplikasi ini sesuai dengan kebutuhan anda, memperbayak jumlah copy atau mendistribusikan aplikasi ini.
Dengan catatan tidak menghapus link developer.</li>
<li>Tidak ada garansi dari kami jika anda mengalami error atau merasa rugi ketika menggunakan aplikasi ini,
Anda hanya dapat memberikan feedback yang berisi laporan error, dengan syarat dan ketentuan yang berlaku.</li>
<li>Semua yang terkait biaya atau donasi apapun versi-nya, Anda dapat update seumur hidup atau selama aplikasi
ini masih dikembangkan. Mohon jangan salah pengertian bahwa kami tim pengembang mengkomersilkan produk ini
dan anda membeli produk kami.</li>
<li>Aplikasi ini bersifat sosial untuk dapat dikembangkan bersama. Karena itu kami juga mengundang relawan-relawan
yang mau menjadi pengembangkan aplikasi ini.</li>
<li>Penulis berhak setiap saat untuk mengubah ketentuan Syarat Penggunaan tanpa pemberitahuan sebelumnya.</li>
</ul>
</div>
<div class="col-md-12"><br>
<a href="step2.php" class="btn btn-primary">Accept &amp; Continue</a>
</div>
</div>
<!-- contents area end -->
</div>
<div class="footer">Copyright &copy; 2021 PHPNuxBill. All Rights Reserved<br /><br /></div>
</body>
</html>

View File

@ -1,6 +1,6 @@
--
-- Database: `phpmixbill`
-- Database: `phpnuxbill`
--
@ -553,7 +553,7 @@ COMMIT;
INSERT INTO
`tbl_appconfig` (`id`, `setting`, `value`)
VALUES (1, 'CompanyName', 'PHPMixBill'), (2, 'currency_code', 'Rp.'), (3, 'language', 'indonesia'), (4, 'show-logo', '1'), (5, 'nstyle', 'blue'), (6, 'timezone', 'Asia/Jakarta'), (7, 'dec_point', ','), (8, 'thousands_sep', '.'), (9, 'rtl', '0'), (10, 'address', ''), (11, 'phone', ''), (12, 'date_format', 'd M Y'), (13, 'note', 'Thank you...');
VALUES (1, 'CompanyName', 'PHPNuxBill'), (2, 'currency_code', 'Rp.'), (3, 'language', 'indonesia'), (4, 'show-logo', '1'), (5, 'nstyle', 'blue'), (6, 'timezone', 'Asia/Jakarta'), (7, 'dec_point', ','), (8, 'thousands_sep', '.'), (9, 'rtl', '0'), (10, 'address', ''), (11, 'phone', ''), (12, 'date_format', 'd M Y'), (13, 'note', 'Thank you...');
--

View File

@ -1,70 +1,70 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>PHPMixBill 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">
<!--[if lt IE 9]>
<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/bootstrap.min.css" rel="stylesheet">
</head>
<body style='background-color: #FBFBFB;'>
<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> PHPMixBill Installer </h4>
<?php
$passed = '';
$ltext = '';
if (version_compare(PHP_VERSION, '7.2.0') >= 0) {
$ltext .= 'To Run PHPMixBill You need at least PHP version 7.2.0, Your PHP Version is: ' . PHP_VERSION . " Tested <strong>---PASSED---</strong><br/>";
$passed .= '1';
} else {
$ltext .= 'To Run PHPMixBill You need at least PHP version 7.2.0, Your PHP Version is: ' . PHP_VERSION . " Tested <strong>---FAILED---</strong><br/>";
$passed .= '0';
}
if (extension_loaded('PDO')) {
$ltext .= 'PDO is installed on your server: ' . "Tested <strong>---PASSED---</strong><br/>";
$passed .= '1';
} else {
$ltext = 'PDO is installed on your server: ' . "Tested <strong>---FAILED---</strong><br/>";
$passed .= '0';
}
if (extension_loaded('pdo_mysql')) {
$ltext .= 'PDO MySQL driver is enabled on your server: ' . "Tested <strong>---PASSED---</strong><br/>";
$passed .= '1';
} else {
$ltext .= 'PDO MySQL driver is not enabled on your server: ' . "Tested <strong>---FAILED---</strong><br/>";
$passed .= '0';
}
if ($passed == '111') {
echo ("<br/> $ltext <br/> Great! System Test Completed. You can run PHPMixBill on your server. Click Continue For Next Step.
<br><br>
<a href=\"step3.php\" class=\"btn btn-primary\">Continue</a><br><br><a href=\"update.php\" class=\"btn btn-primary\">Update System</a>");
} else {
echo ("<br/> $ltext <br/> Sorry. The requirements of PHPMixBill is not available on your server.
Please contact with us- iesien22@yahoo.com with this code- $passed Or contact with your server administrator
<br><br>
<a href=\"#\" class=\"btn btn-primary disabled\">Correct The Problem To Continue</a>");
}
?>
</div>
</div>
<div class="footer">Copyright &copy; 2021 PHPMixBill. All Rights Reserved<br /><br /></div>
</body>
<!DOCTYPE html>
<html lang="en">
<head>
<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">
<!--[if lt IE 9]>
<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/bootstrap.min.css" rel="stylesheet">
</head>
<body style='background-color: #FBFBFB;'>
<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>
<?php
$passed = '';
$ltext = '';
if (version_compare(PHP_VERSION, '7.2.0') >= 0) {
$ltext .= 'To Run PHPNuxBill You need at least PHP version 7.2.0, Your PHP Version is: ' . PHP_VERSION . " Tested <strong>---PASSED---</strong><br/>";
$passed .= '1';
} else {
$ltext .= 'To Run PHPNuxBill You need at least PHP version 7.2.0, Your PHP Version is: ' . PHP_VERSION . " Tested <strong>---FAILED---</strong><br/>";
$passed .= '0';
}
if (extension_loaded('PDO')) {
$ltext .= 'PDO is installed on your server: ' . "Tested <strong>---PASSED---</strong><br/>";
$passed .= '1';
} else {
$ltext = 'PDO is installed on your server: ' . "Tested <strong>---FAILED---</strong><br/>";
$passed .= '0';
}
if (extension_loaded('pdo_mysql')) {
$ltext .= 'PDO MySQL driver is enabled on your server: ' . "Tested <strong>---PASSED---</strong><br/>";
$passed .= '1';
} else {
$ltext .= 'PDO MySQL driver is not enabled on your server: ' . "Tested <strong>---FAILED---</strong><br/>";
$passed .= '0';
}
if ($passed == '111') {
echo ("<br/> $ltext <br/> Great! System Test Completed. You can run PHPNuxBill on your server. Click Continue For Next Step.
<br><br>
<a href=\"step3.php\" class=\"btn btn-primary\">Continue</a><br><br><a href=\"update.php\" class=\"btn btn-primary\">Update System</a>");
} else {
echo ("<br/> $ltext <br/> Sorry. The requirements of PHPNuxBill is not available on your server.
Please contact with us- iesien22@yahoo.com with this code- $passed Or contact with your server administrator
<br><br>
<a href=\"#\" class=\"btn btn-primary disabled\">Correct The Problem To Continue</a>");
}
?>
</div>
</div>
<div class="footer">Copyright &copy; 2021 PHPNuxBill. All Rights Reserved<br /><br /></div>
</body>
</html>

View File

@ -1,72 +1,72 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>PHPMixBill 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">
<!--[if lt IE 9]>
<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/bootstrap.min.css" rel="stylesheet">
</head>
<body style='background-color: #FBFBFB;'>
<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> PHPMixBill Installer </h4>
<?php
if (isset($_GET['_error']) && ($_GET['_error']) == '1') {
echo '<h4 style="color: red;"> Unable to Connect Database, Please make sure database info is correct and try again ! </h4>';
}//
$cururl = (((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off')|| $_SERVER['SERVER_PORT'] == 443)?'https':'http').'://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$appurl = str_replace('/install/step3.php', '', $cururl);
$appurl = str_replace('?_error=1', '', $appurl);
$appurl = str_replace('/system', '', $appurl);
?>
<form action="step4.php" method="post">
<fieldset>
<legend>Database Connection &amp Site config</legend>
<div class="form-group">
<label for="appurl">Application URL</label>
<input type="text" class="form-control" id="appurl" name="appurl" value="<?php echo $appurl; ?>">
<span class='help-block'>Application url without trailing slash at the end of url (e.g. http://172.16.10.10). Please keep default, if you are unsure.</span>
</div>
<div class="form-group">
<label for="dbhost">Database Host</label>
<input type="text" class="form-control" id="dbhost" name="dbhost">
</div>
<div class="form-group">
<label for="dbuser">Database Username</label>
<input type="text" class="form-control" id="dbuser" name="dbuser">
</div>
<div class="form-group">
<label for="dbpass">Database Password</label>
<input type="text" class="form-control" id="dbpass" name="dbpass">
</div>
<div class="form-group">
<label for="dbname">Database Name</label>
<input type="text" class="form-control" id="dbname" name="dbname">
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</fieldset>
</form>
</div>
</div>
<div class="footer">Copyright &copy; 2021 PHPMixBill. All Rights Reserved<br/><br/></div>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<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">
<!--[if lt IE 9]>
<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/bootstrap.min.css" rel="stylesheet">
</head>
<body style='background-color: #FBFBFB;'>
<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>
<?php
if (isset($_GET['_error']) && ($_GET['_error']) == '1') {
echo '<h4 style="color: red;"> Unable to Connect Database, Please make sure database info is correct and try again ! </h4>';
}//
$cururl = (((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off')|| $_SERVER['SERVER_PORT'] == 443)?'https':'http').'://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$appurl = str_replace('/install/step3.php', '', $cururl);
$appurl = str_replace('?_error=1', '', $appurl);
$appurl = str_replace('/system', '', $appurl);
?>
<form action="step4.php" method="post">
<fieldset>
<legend>Database Connection &amp Site config</legend>
<div class="form-group">
<label for="appurl">Application URL</label>
<input type="text" class="form-control" id="appurl" name="appurl" value="<?php echo $appurl; ?>">
<span class='help-block'>Application url without trailing slash at the end of url (e.g. http://172.16.10.10). Please keep default, if you are unsure.</span>
</div>
<div class="form-group">
<label for="dbhost">Database Host</label>
<input type="text" class="form-control" id="dbhost" name="dbhost">
</div>
<div class="form-group">
<label for="dbuser">Database Username</label>
<input type="text" class="form-control" id="dbuser" name="dbuser">
</div>
<div class="form-group">
<label for="dbpass">Database Password</label>
<input type="text" class="form-control" id="dbpass" name="dbpass">
</div>
<div class="form-group">
<label for="dbname">Database Name</label>
<input type="text" class="form-control" id="dbname" name="dbname">
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</fieldset>
</form>
</div>
</div>
<div class="footer">Copyright &copy; 2021 PHPNuxBill. All Rights Reserved<br/><br/></div>
</body>
</html>

View File

@ -1,102 +1,122 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
**/
//error_reporting (0);
$appurl = $_POST['appurl'];
$db_host = $_POST['dbhost'];
$db_user = $_POST['dbuser'];
$db_password = $_POST['dbpass'];
$db_name = $_POST['dbname'];
$cn = '0';
try{
$dbh = new pdo( "mysql:host=$db_host;dbname=$db_name",
"$db_user",
"$db_password",
array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
$cn = '1';
}
catch(PDOException $ex){
$cn = '0';
}
if ($cn == '1') {
$input = '<?php
$db_host = \'' . $db_host . '\';
$db_user = \'' . $db_user . '\';
$db_password = \'' . $db_password . '\';
$db_name = \'' . $db_name . '\';
define(\'APP_URL\', \'' . $appurl . '\');
$_app_stage = \'Live\';';
$wConfig = "../config.php";
$fh = fopen($wConfig, 'w') or die("Can't create config file, your server does not support 'fopen' function,
please create a file named - config.php with following contents- <br/>$input");
fwrite($fh, $input);
fclose($fh);
$sql = file_get_contents('phpmixbill.sql');
$qr = $dbh->exec($sql);
} else {
header("location: step3.php?_error=1");
exit;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>PHPMixBill 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">
<!--[if lt IE 9]>
<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/bootstrap.min.css" rel="stylesheet">
</head>
<body style='background-color: #FBFBFB;'>
<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> PHPMixBill Installer </h4>
<?php
if ($cn == '1') {
?>
<p><strong>Config File Created and Database Imported.</strong><br></p>
<form action="step5.php" method="post">
<fieldset>
<legend>Click Continue</legend>
<button type='submit' class='btn btn-primary'>Continue</button>
</fieldset>
</form>
<?php
} elseif ($cn == '2') {
?>
<p> MySQL Connection was successfull. An error occured while adding data on MySQL. Unsuccessfull
Installation. Please refer manual installation in the website github.com/ibnux/phpmixbill or Contact phpmixbill@ibnux.com for
helping on installation</p>
<?php
} else {
?>
<p> MySQL Connection Failed.</p>
<?php
}
?>
</div>
</div>
<div class="footer">Copyright &copy; 2021 PHPMixBill. All Rights Reserved<br/><br/></div>
</body>
</html>
<?php
/**
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
**/
//error_reporting (0);
$appurl = $_POST['appurl'];
$db_host = $_POST['dbhost'];
$db_user = $_POST['dbuser'];
$db_password = $_POST['dbpass'];
$db_name = $_POST['dbname'];
$cn = '0';
try{
$dbh = new pdo( "mysql:host=$db_host;dbname=$db_name",
"$db_user",
"$db_password",
array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
$cn = '1';
}
catch(PDOException $ex){
$cn = '0';
}
if ($cn == '1') {
$input = '<?php
define(\'APP_URL\', \'' . $appurl . '\');
$_app_stage = \'Live\';
// Database PHPNuxBill
$db_host = \'' . $db_host . '\';
$db_user = \'' . $db_user . '\';
$db_password = \'' . $db_password . '\';
$db_name = \'' . $db_name . '\';
// Database Radius
$radius_host = \'' . $db_host . '\';
$radius_user = \'' . $db_user . '\';
$radius_pass = \'' . $db_password . '\';
$radius_name = \'' . $db_name . '\';
if($_app_stage!=\'Live\'){
error_reporting(E_ERROR);
ini_set(\'display_errors\', 1);
ini_set(\'display_startup_errors\', 1);
}else{
error_reporting(E_ERROR);
ini_set(\'display_errors\', 0);
ini_set(\'display_startup_errors\', 0);
}
';
$wConfig = "../config.php";
$fh = fopen($wConfig, 'w') or die("Can't create config file, your server does not support 'fopen' function,
please create a file named - config.php with following contents- <br/>$input");
fwrite($fh, $input);
fclose($fh);
$sql = file_get_contents('phpnuxbill.sql');
$qr = $dbh->exec($sql);
} else {
header("location: step3.php?_error=1");
exit;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<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">
<!--[if lt IE 9]>
<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/bootstrap.min.css" rel="stylesheet">
</head>
<body style='background-color: #FBFBFB;'>
<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>
<?php
if ($cn == '1') {
?>
<p><strong>Config File Created and Database Imported.</strong><br></p>
<form action="step5.php" method="post">
<fieldset>
<legend>Click Continue</legend>
<button type='submit' class='btn btn-primary'>Continue</button>
</fieldset>
</form>
<?php
} elseif ($cn == '2') {
?>
<p> MySQL Connection was successfull. An error occured while adding data on MySQL. Unsuccessfull
Installation. Please refer manual installation in the website github.com/ibnux/phpnuxbill or Contact phpnuxbill@ibnux.com for
helping on installation</p>
<?php
} else {
?>
<p> MySQL Connection Failed.</p>
<?php
}
?>
</div>
</div>
<div class="footer">Copyright &copy; 2021 PHPNuxBill. All Rights Reserved<br/><br/></div>
</body>
</html>

View File

@ -1,46 +1,46 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>PHPMixBill 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">
<!--[if lt IE 9]>
<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/bootstrap.min.css" rel="stylesheet">
</head>
<body style='background-color: #FBFBFB;'>
<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> PHPMixBill Installer </h4>
<p>
<strong>Congratulations!</strong><br>
You have just install PHPMixBill !<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 PHPMixBill. All Rights Reserved<br/><br/></div>
</body>
<!DOCTYPE html>
<html lang="en">
<head>
<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">
<!--[if lt IE 9]>
<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/bootstrap.min.css" rel="stylesheet">
</head>
<body style='background-color: #FBFBFB;'>
<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

@ -2,7 +2,7 @@
<html lang="en">
<head>
<title>PHPMixBill Updaters</title>
<title>PHPNuxBill Updaters</title>
<link rel="shortcut icon" type="image/x-icon" href="img/favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
@ -23,7 +23,7 @@
</div>
<div class="span12">
<h4> PHPMixBill Updater </h4>
<h4> PHPNuxBill Updater </h4>
<pre><?php
include '../config.php';
try{
@ -103,7 +103,7 @@
?></pre>
</div>
</div>
<div class="footer">Copyright &copy; 2021 PHPMixBill. All Rights Reserved<br /><br /></div>
<div class="footer">Copyright &copy; 2021 PHPNuxBill. All Rights Reserved<br /><br /></div>
</body>
</html>

View File

@ -1,6 +1,6 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
**/
Class Admin{

View File

@ -1,9 +1,9 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
**/
Class App{
class App{
public static function _run(){
return true;
}

56
system/autoload/File.php Normal file
View File

@ -0,0 +1,56 @@
<?php
class File
{
public static function copyFolder($from, $to, $exclude = [])
{
echo "copyFolder($from, $to);<br>";
$files = scandir($from);
print_r($files);
foreach ($files as $file) {
if (is_file($from . $file) && !in_array($file, $exclude)) {
if (file_exists($to . $file)) unlink($to . $file);
rename($from . $file, $to . $file);
echo "rename($from$file, $to$file);<br>";
} else if (is_dir($from . $file) && !in_array($file, ['.', '..'])) {
if (!file_exists($to . $file)) {
echo "mkdir($to$file);;<br>";
mkdir($to . $file);
}
echo "File::copyFolder($from$file, $to$file);<br>";
File::copyFolder($from . $file . DIRECTORY_SEPARATOR, $to . $file . DIRECTORY_SEPARATOR);
}
}
}
public static function deleteFolder($path)
{
$files = scandir($path);
foreach ($files as $file) {
if (is_file($path . $file)) {
echo "unlink($path$file);<br>";
unlink($path . $file);
} else if (is_dir($path . $file) && !in_array($file, ['.', '..'])) {
File::deleteFolder($path . $file . DIRECTORY_SEPARATOR);
echo "rmdir($path$file);<br>";
rmdir($path . $file);
}
}
echo "rmdir($path);<br>";
rmdir($path);
}
/**
* file path fixer
*
* @access public
* @param string $path
* @return string
*/
public static function pathFixer($path)
{
return str_replace("/", DIRECTORY_SEPARATOR, $path);
}
}

View File

@ -0,0 +1,48 @@
<?php
$menu_registered = array();
/**
* Register for global menu
* @param string name Name of the menu
* @param bool admin true if for admin and false for customer
* @param string function function to run after menu clicks
* @param string position position of menu, use AFTER_ for root menu |
* Admin/Sales menu: AFTER_DASHBOARD, CUSTOMERS, PREPAID, SERVICES, REPORTS, VOUCHER, AFTER_ORDER, NETWORK, SETTINGS, AFTER_PAYMENTGATEWAY
* | Customer menu: AFTER_DASHBOARD, ORDER, HISTORY, ACCOUNTS
* @param string icon from ion icon, ion-person, only for AFTER_
*/
function register_menu($name, $admin, $function, $position, $icon = '')
{
global $menu_registered;
$menu_registered[] = [
"name" => $name,
"admin" => $admin,
"position" => $position,
"icon" => $icon,
"function" => $function
];
}
$hook_registered = array();
function register_hook($action, $function){
$hook_registered[] = [
'action' => $action,
'function' => $function
];
}
function run_hook($action){
global $hook_registered;
foreach($hook_registered as $hook){
if($hook['action'] == $action){
if(function_exists($hook['function'])){
call_user_func($hook['function']);
}
}
}
}

View File

@ -1,7 +1,7 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
**/
class Http
@ -40,4 +40,26 @@ class Http
curl_close($ch);
return $server_output;
}
public static function postData($url, $array_post, $headers = [], $basic = null)
{
$headers[] = 'Content-Type: application/x-www-form-urlencoded';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 15);
curl_setopt($ch, CURLOPT_TIMEOUT, 15);
curl_setopt($ch, CURLOPT_VERBOSE, false);
curl_setopt($ch, CURLINFO_HEADER_OUT, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($array_post));
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
if (!empty($basic)) {
curl_setopt($ch, CURLOPT_USERPWD, $basic);
}
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$server_output = curl_exec($ch);
curl_close($ch);
return $server_output;
}
}

View File

@ -1,11 +1,15 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
**/
class Lang {
public static function T($var) {
return Lang($var);
}
public static function htmlspecialchars($var) {
return htmlspecialchars($var);
}
}

View File

@ -0,0 +1,58 @@
<?php
/**
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
**/
class Message
{
public static function sendTelegram($txt)
{
global $config;
run_hook('send_telegram'); #HOOK
if (!empty($config['telegram_bot']) && !empty($config['telegram_target_id'])) {
file_get_contents('https://api.telegram.org/bot' . $config['telegram_bot'] . '/sendMessage?chat_id=' . $config['telegram_target_id'] . '&text=' . urlencode($txt));
}
}
public static function sendSMS($phone, $txt)
{
global $config;
run_hook('send_sms'); #HOOK
if (!empty($config['sms_url'])) {
$smsurl = str_replace('[number]', urlencode($phone), $config['sms_url']);
$smsurl = str_replace('[text]', urlencode($txt), $smsurl);
file_get_contents($smsurl);
}
}
public static function sendWhatsapp($phone, $txt)
{
global $config;
run_hook('send_whatsapp'); #HOOK
if (!empty($config['wa_url'])) {
$waurl = str_replace('[number]', urlencode($phone), $config['wa_url']);
$waurl = str_replace('[text]', urlencode($txt), $waurl);
file_get_contents($waurl);
}
}
public static function sendExpiredNotification($phone, $name, $package, $textExpired, $via)
{
if (
!empty($phone) && strlen($phone) > 5
&& !empty($textExpired) && in_array($via, ['sms', 'wa'])
) {
$msg = str_replace('[[name]]', "*$name*", $textExpired);
$msg = str_replace('[[package]]', "*$package*", $msg);
if ($via == 'sms') {
Message::sendSMS($phone, $msg);
} else if ($via == 'wa') {
Message::sendWhatsapp($phone, $msg);
}
}
}
}

View File

@ -0,0 +1,317 @@
<?php
use PEAR2\Net\RouterOS;
class Mikrotik
{
public static function info($name){
$d = ORM::for_table('tbl_routers')->where('name',$name)->find_one();
return $d;
}
public static function getClient($ip, $user, $pass)
{
try {
$iport = explode(":", $ip);
return new RouterOS\Client($iport[0], $user, $pass, ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>" . $e->getMessage());
}
}
public static function addHotspotPlan($client, $name, $sharedusers, $rate){
$addRequest = new RouterOS\Request('/ip/hotspot/user/profile/add');
$client->sendSync(
$addRequest
->setArgument('name', $name)
->setArgument('shared-users', $sharedusers)
->setArgument('rate-limit', $rate)
);
}
public static function setHotspotPlan($client, $name, $sharedusers, $rate){
$printRequest = new RouterOS\Request(
'/ip hotspot user profile print .proplist=name',
RouterOS\Query::where('name', $name)
);
$profileName = $client->sendSync($printRequest)->getProperty('name');
$setRequest = new RouterOS\Request('/ip/hotspot/user/profile/set');
$client(
$setRequest
->setArgument('numbers', $profileName)
->setArgument('shared-users', $sharedusers)
->setArgument('rate-limit', $rate)
);
}
public static function removeHotspotPlan($client, $name){
$printRequest = new RouterOS\Request(
'/ip hotspot user profile print .proplist=name',
RouterOS\Query::where('name', $name)
);
$profileName = $client->sendSync($printRequest)->getProperty('name');
$removeRequest = new RouterOS\Request('/ip/hotspot/user/profile/remove');
$client(
$removeRequest
->setArgument('numbers', $profileName)
);
}
public static function removeHotspotUser($client, $username)
{
$printRequest = new RouterOS\Request(
'/ip hotspot user print .proplist=name',
RouterOS\Query::where('name', $username)
);
$userName = $client->sendSync($printRequest)->getProperty('name');
$removeRequest = new RouterOS\Request('/ip/hotspot/user/remove');
$client(
$removeRequest
->setArgument('numbers', $userName)
);
}
public static function addHotspotUser($client, $plan, $customer)
{
$addRequest = new RouterOS\Request('/ip/hotspot/user/add');
if ($plan['typebp'] == "Limited") {
if ($plan['limit_type'] == "Time_Limit") {
if ($plan['time_unit'] == 'Hrs')
$timelimit = $plan['time_limit'] . ":00:00";
else
$timelimit = "00:" . $plan['time_limit'] . ":00";
$client->sendSync(
$addRequest
->setArgument('name', $customer['username'])
->setArgument('profile', $plan['name_plan'])
->setArgument('password', $customer['password'])
->setArgument('limit-uptime', $timelimit)
);
} else if ($plan['limit_type'] == "Data_Limit") {
if ($plan['data_unit'] == 'GB')
$datalimit = $plan['data_limit'] . "000000000";
else
$datalimit = $plan['data_limit'] . "000000";
$client->sendSync(
$addRequest
->setArgument('name', $customer['username'])
->setArgument('profile', $plan['name_plan'])
->setArgument('password', $customer['password'])
->setArgument('limit-bytes-total', $datalimit)
);
} else if ($plan['limit_type'] == "Both_Limit") {
if ($plan['time_unit'] == 'Hrs')
$timelimit = $plan['time_limit'] . ":00:00";
else
$timelimit = "00:" . $plan['time_limit'] . ":00";
if ($plan['data_unit'] == 'GB')
$datalimit = $plan['data_limit'] . "000000000";
else
$datalimit = $plan['data_limit'] . "000000";
$client->sendSync(
$addRequest
->setArgument('name', $customer['username'])
->setArgument('profile', $plan['name_plan'])
->setArgument('password', $customer['password'])
->setArgument('limit-uptime', $timelimit)
->setArgument('limit-bytes-total', $datalimit)
);
}
} else {
$client->sendSync(
$addRequest
->setArgument('name', $customer['username'])
->setArgument('profile', $plan['name_plan'])
->setArgument('password', $customer['password'])
);
}
}
public static function setHotspotUser($client, $user, $pass, $nuser= null){
$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('password', $pass);
$client->sendSync($setRequest);
}
public static function removeHotspotActiveUser($client, $username)
{
$onlineRequest = new RouterOS\Request('/ip/hotspot/active/print');
$onlineRequest->setArgument('.proplist', '.id');
$onlineRequest->setQuery(RouterOS\Query::where('user', $username));
$id = $client->sendSync($onlineRequest)->getProperty('.id');
$removeRequest = new RouterOS\Request('/ip/hotspot/active/remove');
$removeRequest->setArgument('numbers', $id);
$client->sendSync($removeRequest);
}
public static function setHotspotLimitUptime($client, $username)
{
$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)
);
$userName = $client->sendSync($printRequest)->getProperty('name');
$removeRequest = new RouterOS\Request('/ppp/secret/remove');
$client(
$removeRequest
->setArgument('numbers', $userName)
);
}
public static function addPpoeUser($client, $plan, $customer)
{
$addRequest = new RouterOS\Request('/ppp/secret/add');
$client->sendSync(
$addRequest
->setArgument('name', $customer['username'])
->setArgument('service', 'pppoe')
->setArgument('profile', $plan['name_plan'])
->setArgument('password', $customer['password'])
);
}
public static function setPpoeUser($client, $user, $pass, $nuser= null){
$printRequest = new RouterOS\Request('/ppp/secret/print');
$printRequest->setArgument('.proplist', '.id');
$printRequest->setQuery(RouterOS\Query::where('name', $user['username']));
$id = $client->sendSync($printRequest)->getProperty('.id');
$setRequest = new RouterOS\Request('/ppp/secret/set');
$setRequest->setArgument('numbers', $id);
$setRequest->setArgument('password', $pass);
$client->sendSync($setRequest);
}
public static function disablePpoeUser($client, $username)
{
$printRequest = new RouterOS\Request('/ppp/secret/print');
$printRequest->setArgument('.proplist', '.id');
$printRequest->setQuery(RouterOS\Query::where('name', $username));
$id = $client->sendSync($printRequest)->getProperty('.id');
$setRequest = new RouterOS\Request('/ppp/secret/disable');
$setRequest->setArgument('numbers', $id);
$client->sendSync($setRequest);
}
public static function removePpoeActive($client, $username)
{
$onlineRequest = new RouterOS\Request('/ppp/active/print');
$onlineRequest->setArgument('.proplist', '.id');
$onlineRequest->setQuery(RouterOS\Query::where('name', $username));
$id = $client->sendSync($onlineRequest)->getProperty('.id');
$removeRequest = new RouterOS\Request('/ppp/active/remove');
$removeRequest->setArgument('numbers', $id);
$client->sendSync($removeRequest);
}
public static function removePool($client, $name){
$printRequest = new RouterOS\Request(
'/ip pool print .proplist=name',
RouterOS\Query::where('name', $name)
);
$poolName = $client->sendSync($printRequest)->getProperty('name');
$removeRequest = new RouterOS\Request('/ip/pool/remove');
$client($removeRequest
->setArgument('numbers', $poolName)
);
}
public static function addPool($client, $name, $ip_address){
$addRequest = new RouterOS\Request('/ip/pool/add');
$client->sendSync($addRequest
->setArgument('name', $name)
->setArgument('ranges', $ip_address)
);
}
public static function setPool($client, $name, $ip_address){
$printRequest = new RouterOS\Request(
'/ip pool print .proplist=name',
RouterOS\Query::where('name', $name)
);
$poolName = $client->sendSync($printRequest)->getProperty('name');
if(empty($poolName)){
self::addPool($client, $name, $ip_address);
}else{
$setRequest = new RouterOS\Request('/ip/pool/set');
$client(
$setRequest
->setArgument('numbers', $poolName)
->setArgument('ranges', $ip_address)
);
}
}
public static function addPpoePlan($client, $name, $pool, $rate){
$addRequest = new RouterOS\Request('/ppp/profile/add');
$client->sendSync(
$addRequest
->setArgument('name', $name)
->setArgument('local-address', $pool)
->setArgument('remote-address', $pool)
->setArgument('rate-limit', $rate)
);
}
public static function setPpoePlan($client, $name, $pool, $rate){
$printRequest = new RouterOS\Request(
'/ppp profile print .proplist=name',
RouterOS\Query::where('name', $name)
);
$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', $profileName)
->setArgument('local-address', $pool)
->setArgument('remote-address', $pool)
->setArgument('rate-limit', $rate)
);
}
}
public static function removePpoePlan($client, $name){
$printRequest = new RouterOS\Request(
'/ppp profile print .proplist=name',
RouterOS\Query::where('name', $name)
);
$profileName = $client->sendSync($printRequest)->getProperty('name');
$removeRequest = new RouterOS\Request('/ppp/profile/remove');
$client(
$removeRequest
->setArgument('numbers', $profileName)
);
}
}

View File

@ -1,7 +1,7 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
**/
@ -32,7 +32,7 @@ class Package
$p = ORM::for_table('tbl_plans')->where('id', $plan_id)->where('enabled', '1')->find_one();
$b = ORM::for_table('tbl_user_recharges')->where('customer_id', $id_customer)->find_one();
$mikrotik = Router::_info($router_name);
$mikrotik = Mikrotik::info($router_name);
if ($p['validity_unit'] == 'Months') {
$date_exp = date("Y-m-d", strtotime('+' . $p['validity'] . ' month'));
} else if ($p['validity_unit'] == 'Days') {
@ -50,79 +50,9 @@ class Package
if ($p['type'] == 'Hotspot') {
if ($b) {
if (!$_c['radius_mode']) {
try {
$iport = explode(":", $mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>" . $e->getMessage());
}
$printRequest = new RouterOS\Request(
'/ip hotspot user print .proplist=name',
RouterOS\Query::where('name', $c['username'])
);
$userName = $client->sendSync($printRequest)->getProperty('name');
$removeRequest = new RouterOS\Request('/ip/hotspot/user/remove');
$client(
$removeRequest
->setArgument('numbers', $userName)
);
/* iBNuX Added:
* Time limit to Mikrotik
* 'Time_Limit', 'Data_Limit', 'Both_Limit'
*/
$addRequest = new RouterOS\Request('/ip/hotspot/user/add');
if ($p['typebp'] == "Limited") {
if ($p['limit_type'] == "Time_Limit") {
if ($p['time_unit'] == 'Hrs')
$timelimit = $p['time_limit'] . ":00:00";
else
$timelimit = "00:" . $p['time_limit'] . ":00";
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-uptime', $timelimit)
);
} else if ($p['limit_type'] == "Data_Limit") {
if ($p['data_unit'] == 'GB')
$datalimit = $p['data_limit'] . "000000000";
else
$datalimit = $p['data_limit'] . "000000";
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-bytes-total', $datalimit)
);
} else if ($p['limit_type'] == "Both_Limit") {
if ($p['time_unit'] == 'Hrs')
$timelimit = $p['time_limit'] . ":00:00";
else
$timelimit = "00:" . $p['time_limit'] . ":00";
if ($p['data_unit'] == 'GB')
$datalimit = $p['data_limit'] . "000000000";
else
$datalimit = $p['data_limit'] . "000000";
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-uptime', $timelimit)
->setArgument('limit-bytes-total', $datalimit)
);
}
} else {
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
);
}
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
Mikrotik::removeHotspotUser($client, $c['username']);
Mikrotik::addHotspotUser($client, $p, $c);
}
$b->customer_id = $id_customer;
@ -153,69 +83,8 @@ class Package
$t->save();
} else {
if (!$_c['radius_mode']) {
try {
$iport = explode(":", $mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>" . $e->getMessage());
}
/* iBNuX Added:
* Time limit to Mikrotik
* 'Time_Limit', 'Data_Limit', 'Both_Limit'
*/
$addRequest = new RouterOS\Request('/ip/hotspot/user/add');
if ($p['typebp'] == "Limited") {
if ($p['limit_type'] == "Time_Limit") {
if ($p['time_unit'] == 'Hrs')
$timelimit = $p['time_limit'] . ":00:00";
else
$timelimit = "00:" . $p['time_limit'] . ":00";
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-uptime', $timelimit)
);
} else if ($p['limit_type'] == "Data_Limit") {
if ($p['data_unit'] == 'GB')
$datalimit = $p['data_limit'] . "000000000";
else
$datalimit = $p['data_limit'] . "000000";
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-bytes-total', $datalimit)
);
} else if ($p['limit_type'] == "Both_Limit") {
if ($p['time_unit'] == 'Hrs')
$timelimit = $p['time_limit'] . ":00:00";
else
$timelimit = "00:" . $p['time_limit'] . ":00";
if ($p['data_unit'] == 'GB')
$datalimit = $p['data_limit'] . "000000000";
else
$datalimit = $p['data_limit'] . "000000";
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-uptime', $timelimit)
->setArgument('limit-bytes-total', $datalimit)
);
}
} else {
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
);
}
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
Mikrotik::addHotspotUser($client, $p, $c);
}
$d = ORM::for_table('tbl_user_recharges')->create();
@ -246,7 +115,7 @@ class Package
$t->type = "Hotspot";
$t->save();
}
sendTelegram("#u$c[username] #buy #Hotspot \n" . $p['name_plan'] .
Message::sendTelegram("#u$c[username] #buy #Hotspot \n" . $p['name_plan'] .
"\nRouter: " . $router_name .
"\nGateway: " . $gateway .
"\nChannel: " . $channel .
@ -255,32 +124,9 @@ class Package
if ($b) {
if (!$_c['radius_mode']) {
try {
$iport = explode(":", $mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>" . $e->getMessage());
}
$printRequest = new RouterOS\Request(
'/ppp secret print .proplist=name',
RouterOS\Query::where('name', $c['username'])
);
$userName = $client->sendSync($printRequest)->getProperty('name');
$removeRequest = new RouterOS\Request('/ppp/secret/remove');
$client(
$removeRequest
->setArgument('numbers', $userName)
);
$addRequest = new RouterOS\Request('/ppp/secret/add');
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('service', 'pppoe')
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
);
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
Mikrotik::removePpoeUser($client, $c['username']);
Mikrotik::addPpoeUser($client, $p, $c);
}
$b->customer_id = $id_customer;
@ -311,20 +157,8 @@ class Package
$t->save();
} else {
if (!$_c['radius_mode']) {
try {
$iport = explode(":", $mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>" . $e->getMessage());
}
$addRequest = new RouterOS\Request('/ppp/secret/add');
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('service', 'pppoe')
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
);
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
Mikrotik::addPpoeUser($client, $p, $c);
}
$d = ORM::for_table('tbl_user_recharges')->create();
@ -355,7 +189,7 @@ class Package
$t->type = "PPPOE";
$t->save();
}
sendTelegram("#u$c[username] #buy #PPPOE \n" . $p['name_plan'] .
Message::sendTelegram("#u$c[username] #buy #PPPOE \n" . $p['name_plan'] .
"\nRouter: " . $router_name .
"\nGateway: " . $gateway .
"\nChannel: " . $channel .
@ -364,7 +198,7 @@ class Package
$in = ORM::for_table('tbl_transactions')->where('username', $c['username'])->order_by_desc('id')->find_one();
sendWhatsapp($c['username'], "*$_c[CompanyName]*\n" .
$msg = "*$_c[CompanyName]*\n" .
"$_c[address]\n" .
"$_c[phone]\n" .
"\n\n" .
@ -380,7 +214,13 @@ class Package
"$_L[Created_On] :\n*" . date($_c['date_format'], strtotime($in['recharged_on'])) . " $in[time]*\n" .
"$_L[Expires_On] :\n*" . date($_c['date_format'], strtotime($in['expiration'])) . " $in[time]*\n" .
"\n\n" .
"$_c[note]");
"$_c[note]";
if ($_c['user_notification_payment'] == 'sms') {
Message::sendSMS($c['phonenumber'], $msg);
} else if ($_c['user_notification_payment'] == 'wa') {
Message::sendWhatsapp($c['phonenumber'], $msg);
}
return true;
}
}

View File

@ -1,6 +1,6 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
**/
Class Paginator

View File

@ -1,7 +1,7 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
**/

View File

@ -0,0 +1,5 @@
<?php
class Radius {
}

View File

@ -1,11 +0,0 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
**/
Class Router{
public static function _info($name){
$d = ORM::for_table('tbl_routers')->where('name',$name)->find_one();
return $d;
}
}

View File

@ -1,6 +1,6 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
**/
class Timezone {

View File

@ -1,6 +1,6 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
**/
Class User{

View File

@ -1,12 +1,14 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
**/
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
**/
/**
* Validator class
*/
class Validator{
class Validator
{
/**
* String text finder
@ -16,14 +18,15 @@ class Validator{
* @param array $hits
* @return void
*/
private static function textHit($string, $exclude=""){
if(empty($exclude)) return false;
if(is_array($exclude)){
foreach($exclude as $text){
if(strstr($string, $text)) return true;
private static function textHit($string, $exclude = "")
{
if (empty($exclude)) return false;
if (is_array($exclude)) {
foreach ($exclude as $text) {
if (strstr($string, $text)) return true;
}
}else{
if(strstr($string, $exclude)) return true;
} else {
if (strstr($string, $exclude)) return true;
}
return false;
}
@ -37,9 +40,10 @@ class Validator{
* @param int $min
* @return bool
*/
private static function numberBetween($integer, $max=null, $min=0){
if(is_numeric($min) && $integer <= $min) return false;
if(is_numeric($max) && $integer >= $max) return false;
private static function numberBetween($integer, $max = null, $min = 0)
{
if (is_numeric($min) && $integer <= $min) return false;
if (is_numeric($max) && $integer >= $max) return false;
return true;
}
@ -51,8 +55,9 @@ class Validator{
* @param array $exclude
* @return bool
*/
public static function Email($string, $exclude=""){
if(self::textHit($string, $exclude)) return false;
public static function Email($string, $exclude = "")
{
if (self::textHit($string, $exclude)) return false;
return (bool)preg_match("/^([a-z0-9])(([-a-z0-9._])*([a-z0-9]))*\@([a-z0-9])(([a-z0-9-])*([a-z0-9]))+(\.([a-z0-9])([-a-z0-9_-])?([a-z0-9])+)+$/i", $string);
}
@ -63,8 +68,9 @@ class Validator{
* @param strin $string
* @return bool
*/
public static function Url($string, $exclude=""){
if(self::textHit($string, $exclude)) return false;
public static function Url($string, $exclude = "")
{
if (self::textHit($string, $exclude)) return false;
return (bool)preg_match("/^(http|https|ftp):\/\/([A-Z0-9][A-Z0-9_-]*(?:\.[A-Z0-9][A-Z0-9_-]*)+):?(\d+)?\/?/i", $string);
}
@ -75,7 +81,8 @@ class Validator{
* @param string $string
* @return void
*/
public static function Ip($string){
public static function Ip($string)
{
return (bool)preg_match("/^(1?\d{1,2}|2([0-4]\d|5[0-5]))(\.(1?\d{1,2}|2([0-4]\d|5[0-5]))){3}$/", $string);
}
@ -88,9 +95,10 @@ class Validator{
* @param int $min
* @return bool
*/
public static function Number($integer, $max=null, $min=0){
if(preg_match("/^\-?\+?[0-9e1-9]+$/",$integer)){
if(!self::numberBetween($integer, $max, $min)) return false;
public static function Number($integer, $max = null, $min = 0)
{
if (preg_match("/^\-?\+?[0-9e1-9]+$/", $integer)) {
if (!self::numberBetween($integer, $max, $min)) return false;
return true;
}
return false;
@ -103,8 +111,9 @@ class Validator{
* @param int $integer
* @return bool
*/
public static function UnsignedNumber($integer){
return (bool)preg_match("/^\+?[0-9]+$/",$integer);
public static function UnsignedNumber($integer)
{
return (bool)preg_match("/^\+?[0-9]+$/", $integer);
}
/**
@ -114,8 +123,9 @@ class Validator{
* @param string $string
* @return bool
*/
public static function Float($string){
return (bool)($string==strval(floatval($string)))? true : false;
public static function Float($string)
{
return (bool)($string == strval(floatval($string))) ? true : false;
}
/**
@ -125,7 +135,8 @@ class Validator{
* @param string $string
* @return void
*/
public static function Alpha($string){
public static function Alpha($string)
{
return (bool)preg_match("/^[a-zA-Z]+$/", $string);
}
@ -136,7 +147,8 @@ class Validator{
* @param string $string
* @return void
*/
public static function AlphaNumeric($string){
public static function AlphaNumeric($string)
{
return (bool)preg_match("/^[0-9a-zA-Z]+$/", $string);
}
@ -148,7 +160,8 @@ class Validator{
* @param array $allowed
* @return void
*/
public static function Chars($string, $allowed=array("a-z")){
public static function Chars($string, $allowed = array("a-z"))
{
return (bool)preg_match("/^[" . implode("", $allowed) . "]+$/", $string);
}
@ -161,9 +174,10 @@ class Validator{
* @param int $min
* @return bool
*/
public static function Length($string, $max=null, $min=0){
public static function Length($string, $max = null, $min = 0)
{
$length = strlen($string);
if(!self::numberBetween($length, $max, $min)) return false;
if (!self::numberBetween($length, $max, $min)) return false;
return true;
}
@ -174,7 +188,8 @@ class Validator{
* @param string $string
* @return void
*/
public static function HexColor($string){
public static function HexColor($string)
{
return (bool)preg_match("/^(#)?([0-9a-f]{1,2}){3}$/i", $string);
}
@ -191,7 +206,8 @@ class Validator{
* @param string $string
* @return bool
*/
public static function Date($string){
public static function Date($string)
{
$date = date('Y', strtotime($string));
return ($date == "1970" || $date == '') ? false : true;
}
@ -204,9 +220,10 @@ class Validator{
* @param int $age
* @return bool
*/
public static function OlderThan($string, $age){
public static function OlderThan($string, $age)
{
$date = date('Y', strtotime($string));
if($date == "1970" || $date == '') return false;
if ($date == "1970" || $date == '') return false;
return (date('Y') - $date) > $age ? true : false;
}
@ -217,7 +234,8 @@ class Validator{
* @param string $string
* @return bool
*/
public static function Xml($string){
public static function Xml($string)
{
$Xml = @simplexml_load_string($string);
return ($Xml === false) ? false : true;
}
@ -231,7 +249,8 @@ class Validator{
* @param int $min
* @return bool
*/
public static function FilesizeBetween($file, $max=null, $min=0){
public static function FilesizeBetween($file, $max = null, $min = 0)
{
$filesize = filesize($file);
return self::numberBetween($filesize, $max, $min);
}
@ -247,10 +266,11 @@ class Validator{
* @param int $min_height
* @return void
*/
public static function ImageSizeBetween($image, $max_width="", $min_width=0, $max_height="", $min_height=0){
public static function ImageSizeBetween($image, $max_width = "", $min_width = 0, $max_height = "", $min_height = 0)
{
$size = getimagesize($image);
if(!self::numberBetween($size[0], $max_width, $min_width)) return false;
if(!self::numberBetween($size[1], $max_height, $min_height)) return false;
if (!self::numberBetween($size[0], $max_width, $min_width)) return false;
if (!self::numberBetween($size[1], $max_height, $min_height)) return false;
return true;
}
@ -261,8 +281,10 @@ class Validator{
* @param string $phone
* @return bool
*/
public static function Phone($phone){
$formats = array( '###-###-####',
public static function Phone($phone)
{
$formats = array(
'###-###-####',
'####-###-###',
'(###) ###-###',
'####-####-####',
@ -271,9 +293,10 @@ class Validator{
'###-###-###',
'#####-###-###',
'##########',
'####-##-##-##');
'####-##-##-##'
);
$format = trim(preg_replace("/[0-9]/", "#", $phone));
return (bool)in_array($format, $formats);
}
}
}

View File

@ -1,7 +1,7 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
**/
session_start();
@ -17,12 +17,13 @@ function r2($to, $ntype = 'e', $msg = '')
exit;
}
if (file_exists('system/config.php')) {
require('system/config.php');
if (file_exists('config.php')) {
require('config.php');
} else {
r2('system/install');
r2('install');
}
function safedata($value)
{
$value = trim($value);
@ -55,7 +56,9 @@ ORM::configure('username', $db_user);
ORM::configure('password', $db_password);
ORM::configure('driver_options', array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'));
ORM::configure('return_result_sets', true);
ORM::configure('logging', true);
if($_app_stage != 'Live'){
ORM::configure('logging', true);
}
$result = ORM::for_table('tbl_appconfig')->find_many();
foreach ($result as $value) {
@ -65,6 +68,14 @@ foreach ($result as $value) {
date_default_timezone_set($config['timezone']);
$_c = $config;
if($config['radius_mode']){
ORM::configure("mysql:host=$radius_host;dbname=$radius_name", null, 'radius');
ORM::configure('username', $radius_user, 'radius');
ORM::configure('password', $radius_password, 'radius');
ORM::configure('driver_options', array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'), 'radius');
ORM::configure('return_result_sets', true, 'radius');
}
function _notify($msg, $type = 'e')
{
$_SESSION['ntype'] = $type;
@ -72,19 +83,19 @@ function _notify($msg, $type = 'e')
}
require_once('system/vendors/smarty/libs/Smarty.class.php');
$_theme = APP_URL . '/ui/ui';
$lan_file = 'system/lan/' . $config['language'] . '/common.lan.php';
require($lan_file);
$ui = new Smarty();
$ui->setTemplateDir('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)));
$ui->assign('_domain', str_replace('www.', '', parse_url(APP_URL, PHP_URL_HOST)));
define('U', APP_URL . '/index.php?_route=');
$ui->assign('_url', APP_URL . '/index.php?_route=');
$ui->assign('_theme', $_theme);
$ui->assign('_path', __DIR__);
$ui->assign('_c', $config);
$ui->assign('_L', $_L);
@ -117,53 +128,69 @@ if (isset($_SESSION['notify'])) {
unset($_SESSION['ntype']);
}
include "autoload/Hookers.php";
//register all plugin
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('_', '/', $class);
if (file_exists('autoload/' . $class . '.php')) {
include 'autoload/' . $class . '.php';
$class = str_replace('_', DIRECTORY_SEPARATOR, $class);
if (file_exists('autoload' . DIRECTORY_SEPARATOR . $class . '.php')) {
include 'autoload' . DIRECTORY_SEPARATOR . $class . '.php';
} else {
$class = str_replace("\\", "/", $class);
if (file_exists(__DIR__ . '/autoload/' . $class . '.php'))
include __DIR__ . '/autoload/' . $class . '.php';
$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/' . $class . '.php')) {
include 'autoload/' . $class . '.php';
if (file_exists('autoload' . DIRECTORY_SEPARATOR . $class . '.php')) {
include 'autoload' . DIRECTORY_SEPARATOR . $class . '.php';
} else {
$class = str_replace("\\", "/", $class);
if (file_exists(__DIR__ . '/autoload/' . $class . '.php'))
include __DIR__ . '/autoload/' . $class . '.php';
$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()
function _auth($login = true)
{
if (isset($_SESSION['uid'])) {
return true;
} else {
r2(U . 'login');
if ($login) {
r2(U . 'login');
} else {
return false;
}
}
}
function _admin()
function _admin($login = true)
{
if (isset($_SESSION['aid'])) {
return true;
} else {
r2(U . 'login');
if ($login) {
r2(U . 'login');
} else {
return false;
}
}
}
function _raid($l)
{
$r = substr(str_shuffle(str_repeat('0123456789', $l)), 0, $l);
return $r;
return substr(str_shuffle(str_repeat('0123456789', $l)), 0, $l);
}
function _log($description, $type = '', $userid = '0')
@ -177,20 +204,21 @@ function _log($description, $type = '', $userid = '0')
$d->save();
}
function Lang($key){
global $_L,$lan_file;
if(!empty($_L[$key])){
function Lang($key)
{
global $_L, $lan_file;
if (!empty($_L[$key])) {
return $_L[$key];
}
$val = $key;
$key = alphanumeric($key," ");
if(!empty($_L[$key])){
$key = alphanumeric($key, " ");
if (!empty($_L[$key])) {
return $_L[$key];
}else if(!empty($_L[str_replace(' ','_',$key)])){
return $_L[str_replace(' ','_',$key)];
}else{
$key = str_replace(' ','_',$key);
file_put_contents($lan_file, "$"."_L['$key'] = '".addslashes($val)."';\n", FILE_APPEND);
} else if (!empty($_L[str_replace(' ', '_', $key)])) {
return $_L[str_replace(' ', '_', $key)];
} else {
$key = str_replace(' ', '_', $key);
file_put_contents($lan_file, "$" . "_L['$key'] = '" . addslashes($val) . "';\n", FILE_APPEND);
return $val;
}
}
@ -200,37 +228,6 @@ function alphanumeric($str, $tambahan = "")
return preg_replace("/[^a-zA-Z0-9" . $tambahan . "]+/", "", $str);
}
function sendTelegram($txt)
{
global $_c;
if(!empty($_c['telegram_bot']) && !empty($_c['telegram_target_id'])){
file_get_contents('https://api.telegram.org/bot'.$_c['telegram_bot'].'/sendMessage?chat_id='.$_c['telegram_target_id'].'&text=' . urlencode($txt));
}
}
function sendSMS($phone, $txt)
{
global $_c;
if(!empty($_c['sms_url'])){
$smsurl = str_replace('[number]',urlencode($phone),$_c['sms_url']);
$smsurl = str_replace('[text]',urlencode($txt),$smsurl);
file_get_contents($smsurl);
}
}
function sendWhatsapp($phone, $txt)
{
global $_c;
if(!empty($_c['wa_url'])){
$waurl = str_replace('[number]',urlencode($phone),$_c['wa_url']);
$waurl = str_replace('[text]',urlencode($txt),$waurl);
file_get_contents($waurl);
}
}
function time_elapsed_string($datetime, $full = false)
{
$now = new DateTime;
@ -264,34 +261,39 @@ function time_elapsed_string($datetime, $full = false)
// Routing Engine
$req = _get('_route');
$routes = explode('/', $req);
$handler = $routes['0'];
$ui->assign('_routes', $routes);
$handler = $routes[0];
if ($handler == '') {
$handler = 'default';
}
$sys_render = 'system/controllers/' . $handler . '.php';
if (file_exists($sys_render)) {
$menus = array();
// "name" => $name,
// "admin" => $admin,
// "position" => $position,
// "function" => $function
$ui->assign('_system_menu', $routes[0]);
foreach ($menu_registered as $menu) {
if($menu['admin'] && _admin(false)) {
$menus[$menu['position']] .= '<li'.(($routes[1]==$menu['function'])?' class="active"':'').'><a href="'.U.'plugin/'.$menu['function'].'">';
if(!empty($menu['icon'])){
$menus[$menu['position']] .= '<i class="'.$menu['icon'].'"></i>';
}
$menus[$menu['position']] .= '<span class="text">'.$menu['name'].'</span></a></li>';
}else if(!$menu['admin'] && _auth(false)) {
$menus[$menu['position']] .= '<li'.(($routes[1]==$menu['function'])?' class="active"':'').'><a href="'.U.'plugin/'.$menu['function'].'">';
if(!empty($menu['icon'])){
$menus[$menu['position']] .= '<i class="'.$menu['icon'].'"></i>';
}
$menus[$menu['position']] .= '<span class="text">'.$menu['name'].'</span></a></li>';
}
}
foreach ($menus as $k => $v) {
$ui->assign('_MENU_'.$k, $v);
}
unset($menus, $menu_registered);
include($sys_render);
} else {
header("HTTP/1.0 404 Not Found");
exit("<pre>
___ ___ ___
| | | | | |
|_ | | |_ |
|_|___| |_|
_____ _ _____ _
| | |___| |_ | __|___ _ _ ___ _| |
| | | | . | _| | __| . | | | | . |
|_|___|___|_| |__| |___|___|_|_|___|
_ ______ ____ _____ ____ ____
(_) |_ _ \ |_ \|_ _| |_ _||_ _|
__ | |_) | | \ | | __ _ \ \ / /
[ | | __'. | |\ \| | [ | | | > `' <
| | _| |__) |_| |_\ |_ | \_/ |, _/ /'`\ \_
[___]|_______/|_____|\____|'.__.'_/|____||____|
</pre>");
r2(U.'dashboard', 'e', 'not found');
}

0
system/cache/index.html vendored Normal file
View File

View File

@ -1,9 +1,9 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
**/
_auth();
$ui->assign('_title', $_L['My_Account'].'- '. $config['CompanyName']);
$ui->assign('_title', $_L['My_Account']);
$ui->assign('_system_menu', 'accounts');
$action = $routes['1'];
@ -16,11 +16,13 @@ require_once 'system/autoload/PEAR2/Autoload.php';
switch ($action) {
case 'change-password':
run_hook('customer_view_change_password'); #HOOK
$ui->display('user-change-password.tpl');
break;
case 'change-password-post':
$password = _post('password');
run_hook('customer_change_password'); #HOOK
if($password != ''){
$d = ORM::for_table('tbl_customers')->where('username',$user['username'])->find_one();
if($d){
@ -38,34 +40,12 @@ switch ($action) {
$c = ORM::for_table('tbl_user_recharges')->where('username',$user['username'])->find_one();
if ($c){
$mikrotik = Router::_info($c['routers']);
$mikrotik = Mikrotik::info($c['routers']);
if($c['type'] == 'Hotspot'){
if(!$_c['radius_mode']){
try {
$iport = explode(":",$mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'],($iport[1])?$iport[1]:null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>".$e->getMessage());
}
$printRequest = new RouterOS\Request('/ip/hotspot/user/print');
$printRequest->setArgument('.proplist', '.id');
$printRequest->setQuery(RouterOS\Query::where('name', $user['username']));
$id = $client->sendSync($printRequest)->getProperty('.id');
$setRequest = new RouterOS\Request('/ip/hotspot/user/set');
$setRequest->setArgument('numbers', $id);
$setRequest->setArgument('password', $npass);
$client->sendSync($setRequest);
//remove hotspot active
$onlineRequest = new RouterOS\Request('/ip/hotspot/active/print');
$onlineRequest->setArgument('.proplist', '.id');
$onlineRequest->setQuery(RouterOS\Query::where('user', $user['username']));
$id = $client->sendSync($onlineRequest)->getProperty('.id');
$removeRequest = new RouterOS\Request('/ip/hotspot/active/remove');
$removeRequest->setArgument('numbers', $id);
$client->sendSync($removeRequest);
if(!$config['radius_mode']){
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
Mikrotik::setHotspotUser($client,$c['username'],$npass);
Mikrotik::removeHotspotActiveUser($client,$user['username']);
}
$d->password = $npass;
$d->save();
@ -76,32 +56,10 @@ switch ($action) {
r2(U.'login');
}else{
if(!$_c['radius_mode']){
try {
$iport = explode(":",$mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'],($iport[1])?$iport[1]:null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>".$e->getMessage());
}
$printRequest = new RouterOS\Request('/ppp/secret/print');
$printRequest->setArgument('.proplist', '.id');
$printRequest->setQuery(RouterOS\Query::where('name', $user['username']));
$id = $client->sendSync($printRequest)->getProperty('.id');
$setRequest = new RouterOS\Request('/ppp/secret/set');
$setRequest->setArgument('numbers', $id);
$setRequest->setArgument('password', $npass);
$client->sendSync($setRequest);
//remove pppoe active
$onlineRequest = new RouterOS\Request('/ppp/active/print');
$onlineRequest->setArgument('.proplist', '.id');
$onlineRequest->setQuery(RouterOS\Query::where('name', $user['username']));
$id = $client->sendSync($onlineRequest)->getProperty('.id');
$removeRequest = new RouterOS\Request('/ppp/active/remove');
$removeRequest->setArgument('numbers', $id);
$client->sendSync($removeRequest);
if(!$config['radius_mode']){
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
Mikrotik::setPpoeUser($client,$c['username'],$npass);
Mikrotik::removePpoeActive($client,$user['username']);
}
$d->password = $npass;
$d->save();
@ -137,6 +95,7 @@ switch ($action) {
$id = $_SESSION['uid'];
$d = ORM::for_table('tbl_customers')->find_one($id);
if($d){
run_hook('customer_view_edit_profile'); #HOOK
$ui->assign('d',$d);
$ui->display('user-profile.tpl');
}else{
@ -147,8 +106,9 @@ switch ($action) {
case 'edit-profile-post':
$fullname = _post('fullname');
$address = _post('address');
$email = _post('email');
$phonenumber = _post('phonenumber');
run_hook('customer_edit_profile'); #HOOK
$msg = '';
if(Validator::Length($fullname,31,2) == false){
$msg .= 'Full Name should be between 3 to 30 characters'. '<br>';
@ -167,6 +127,7 @@ switch ($action) {
if($msg == ''){
$d->fullname = $fullname;
$d->address = $address;
$d->email = $email;
$d->phonenumber = $phonenumber;
$d->save();

View File

@ -1,49 +1,46 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
**/
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
**/
if (isset($routes['1'])) {
$do = $routes['1'];
} else {
$do = 'login-display';
}
switch($do){
switch ($do) {
case 'post':
$username = _post('username');
$password = _post('password');
if($username != '' AND $password != ''){
$d = ORM::for_table('tbl_users')->where('username',$username)->find_one();
if($d){
$d_pass = $d['password'];
if(Password::_verify($password,$d_pass) == true){
$_SESSION['aid'] = $d['id'];
$d->last_login = date('Y-m-d H:i:s');
$d->save();
_log($username .' '. $_L['Login_Successful'],'Admin',$d['id']);
r2(U.'dashboard');
}else{
_msglog('e',$_L['Invalid_Username_or_Password']);
_log($username .' '. $_L['Failed_Login'],'Admin');
r2(U.'admin');
}
}else{
_msglog('e',$_L['Invalid_Username_or_Password']);
r2(U.'admin');
}
}else{
_msglog('e',$_L['Invalid_Username_or_Password']);
r2(U.'admin');
}
$username = _post('username');
$password = _post('password');
run_hook('admin_login'); #HOOK
if ($username != '' and $password != '') {
$d = ORM::for_table('tbl_users')->where('username', $username)->find_one();
if ($d) {
$d_pass = $d['password'];
if (Password::_verify($password, $d_pass) == true) {
$_SESSION['aid'] = $d['id'];
$d->last_login = date('Y-m-d H:i:s');
$d->save();
_log($username . ' ' . $_L['Login_Successful'], 'Admin', $d['id']);
r2(U . 'dashboard');
} else {
_msglog('e', $_L['Invalid_Username_or_Password']);
_log($username . ' ' . $_L['Failed_Login'], 'Admin');
r2(U . 'admin');
}
} else {
_msglog('e', $_L['Invalid_Username_or_Password']);
r2(U . 'admin');
}
} else {
_msglog('e', $_L['Invalid_Username_or_Password']);
r2(U . 'admin');
}
break;
case 'login-display':
$ui->display('admin.tpl');
break;
default:
$ui->display('admin.tpl');
run_hook('view_login'); #HOOK
$ui->display('admin-login.tpl');
break;
}

View File

@ -1,9 +1,11 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
* used for ajax
**/
_admin();
$ui->assign('_title', $_L['Network'].' - '. $config['CompanyName']);
$ui->assign('_title', $_L['Network']);
$ui->assign('_system_menu', 'network');
$action = $routes['1'];
@ -15,7 +17,6 @@ switch ($action) {
$routers = _get('routers');
$d = ORM::for_table('tbl_pool')->where('routers', $routers)->find_many();
$ui->assign('d',$d);
$ui->display('autoload-pool.tpl');
break;

View File

@ -1,9 +1,9 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
**/
_admin();
$ui->assign('_title', $_L['Bandwidth_Plans'].' - '. $config['CompanyName']);
$ui->assign('_title', $_L['Bandwidth_Plans']);
$ui->assign('_system_menu', 'services');
$action = $routes['1'];
@ -17,7 +17,7 @@ if($admin['user_type'] != 'Admin' AND $admin['user_type'] != 'Sales'){
switch ($action) {
case 'list':
$ui->assign('xfooter', '<script type="text/javascript" src="ui/lib/c/bandwidth.js"></script>');
run_hook('view_list_bandwidth'); #HOOK
$name = _post('name');
if ($name != ''){
$paginator = Paginator::bootstrap('tbl_bandwidth','name_bw','%'.$name.'%');
@ -33,11 +33,13 @@ switch ($action) {
break;
case 'add':
run_hook('view_add_bandwidth'); #HOOK
$ui->display('bandwidth-add.tpl');
break;
case 'edit':
$id = $routes['2'];
run_hook('view_edit_bandwith'); #HOOK
$d = ORM::for_table('tbl_bandwidth')->find_one($id);
if($d){
$ui->assign('d',$d);
@ -49,6 +51,7 @@ switch ($action) {
case 'delete':
$id = $routes['2'];
run_hook('delete_bandwidth'); #HOOK
$d = ORM::for_table('tbl_bandwidth')->find_one($id);
if($d){
$d->delete();
@ -62,7 +65,7 @@ switch ($action) {
$rate_down_unit = _post('rate_down_unit');
$rate_up = _post('rate_up');
$rate_up_unit = _post('rate_up_unit');
run_hook('add_bandwidth'); #HOOK
$msg = '';
if(Validator::Length($name,16,4) == false){
$msg .= 'Name should be between 5 to 15 characters'. '<br>';
@ -97,7 +100,7 @@ switch ($action) {
$rate_down_unit = _post('rate_down_unit');
$rate_up = _post('rate_up');
$rate_up_unit = _post('rate_up_unit');
run_hook('edit_bandwidth'); #HOOK
$msg = '';
if(Validator::Length($name,16,4) == false){
$msg .= 'Name should be between 5 to 15 characters'. '<br>';

View File

@ -1,28 +1,20 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
**/
_auth();
$ui->assign('_system_menu', 'order');
$action = $routes['1'];
$user = User::_info();
$ui->assign('_user', $user);
require('system/autoload/Paymentgateway.php');
require('system/autoload/Recharge.php');
if(file_exists('system/paymentgateway/'.$action.'.php')){
include 'system/paymentgateway/'.$action.'.php';
if(function_exists($action.'_payment_notification')){
run_hook('callback_payment_notification'); #HOOK
call_user_func($action.'_payment_notification');
die();
}
}
switch ($action) {
case 'xendit':
echo "done";
break;
case 'midtrans':
echo "done";
break;
case 'tripay':
echo '{"success": true}';
break;
default:
echo "not found";
}
header('HTTP/1.1 404 Not Found');
echo 'Not Found';

View File

@ -1,9 +1,9 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
**/
_auth();
$ui->assign('_title', 'Community - '. $config['CompanyName']);
_admin();
$ui->assign('_title', 'Community');
$ui->assign('_system_menu', 'community');
$action = $routes['1'];

View File

@ -1,11 +1,11 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
**/
_admin();
$ui->assign('_title', $_L['Customers'] . ' - ' . $config['CompanyName']);
$ui->assign('_title', $_L['Customers']);
$ui->assign('_system_menu', 'customers');
$action = $routes['1'];
@ -24,6 +24,7 @@ switch ($action) {
case 'list':
$ui->assign('xfooter', '<script type="text/javascript" src="ui/lib/c/customers.js"></script>');
$username = _post('username');
run_hook('list_customers'); #HOOK
if ($username != '') {
$paginator = Paginator::bootstrap('tbl_customers', 'username', '%' . $username . '%');
$d = ORM::for_table('tbl_customers')->where_like('username', '%' . $username . '%')->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_desc('id')->find_many();
@ -38,11 +39,13 @@ switch ($action) {
break;
case 'add':
run_hook('view_add_customer'); #HOOK
$ui->display('customers-add.tpl');
break;
case 'edit':
$id = $routes['2'];
run_hook('edit_customer'); #HOOK
$d = ORM::for_table('tbl_customers')->find_one($id);
if ($d) {
$ui->assign('d', $d);
@ -54,70 +57,29 @@ switch ($action) {
case 'delete':
$id = $routes['2'];
run_hook('delete_customer'); #HOOK
$d = ORM::for_table('tbl_customers')->find_one($id);
if ($d) {
$c = ORM::for_table('tbl_user_recharges')->where('username', $d['username'])->find_one();
if ($c) {
$mikrotik = Router::_info($c['routers']);
$mikrotik = Mikrotik::info($c['routers']);
if ($c['type'] == 'Hotspot') {
if(!$_c['radius_mode']){
try {
$iport = explode(":", $mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>" . $e->getMessage());
}
$printRequest = new RouterOS\Request('/ip/hotspot/user/print');
$printRequest->setArgument('.proplist', '.id');
$printRequest->setQuery(RouterOS\Query::where('name', $c['username']));
$id = $client->sendSync($printRequest)->getProperty('.id');
$setRequest = new RouterOS\Request('/ip/hotspot/user/remove');
$setRequest->setArgument('numbers', $id);
$client->sendSync($setRequest);
//remove hotspot active
$onlineRequest = new RouterOS\Request('/ip/hotspot/active/print');
$onlineRequest->setArgument('.proplist', '.id');
$onlineRequest->setQuery(RouterOS\Query::where('user', $c['username']));
$id = $client->sendSync($onlineRequest)->getProperty('.id');
$removeRequest = new RouterOS\Request('/ip/hotspot/active/remove');
$removeRequest->setArgument('numbers', $id);
$client->sendSync($removeRequest);
if(!$config['radius_mode']){
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
Mikrotik::removeHotspotUser($client,$c['username']);
Mikrotik::removeHotspotActiveUser($client,$user['username']);
}
} else {
if(!$_c['radius_mode']){
try {
$iport = explode(":", $mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>" . $e->getMessage());
}
$printRequest = new RouterOS\Request('/ppp/secret/print');
$printRequest->setArgument('.proplist', '.id');
$printRequest->setQuery(RouterOS\Query::where('name', $c['username']));
$id = $client->sendSync($printRequest)->getProperty('.id');
$setRequest = new RouterOS\Request('/ppp/secret/remove');
$setRequest->setArgument('numbers', $id);
$client->sendSync($setRequest);
//remove pppoe active
$onlineRequest = new RouterOS\Request('/ppp/active/print');
$onlineRequest->setArgument('.proplist', '.id');
$onlineRequest->setQuery(RouterOS\Query::where('name', $c['username']));
$id = $client->sendSync($onlineRequest)->getProperty('.id');
$removeRequest = new RouterOS\Request('/ppp/active/remove');
$removeRequest->setArgument('numbers', $id);
$client->sendSync($removeRequest);
if(!$config['radius_mode']){
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
Mikrotik::removePpoeUser($client,$c['username']);
Mikrotik::removePpoeActive($client,$user['username']);
}
}
try {
$d->delete();
} catch (Exception $e) {
} catch(Throwable $e){
}
try {
$c->delete();
@ -127,10 +89,12 @@ switch ($action) {
try {
$d->delete();
} catch (Exception $e) {
} catch(Throwable $e){
}
try {
$c->delete();
} catch (Exception $e) {
} catch(Throwable $e){
}
}
@ -145,7 +109,7 @@ switch ($action) {
$cpassword = _post('cpassword');
$address = _post('address');
$phonenumber = _post('phonenumber');
run_hook('add_customer'); #HOOK
$msg = '';
if (Validator::Length($username, 35, 2) == false) {
$msg .= 'Username should be between 3 to 55 characters' . '<br>';
@ -186,7 +150,7 @@ switch ($action) {
$cpassword = _post('cpassword');
$address = _post('address');
$phonenumber = _post('phonenumber');
run_hook('edit_customer'); #HOOK
$msg = '';
if (Validator::Length($username, 16, 2) == false) {
$msg .= 'Username should be between 3 to 15 characters' . '<br>';
@ -219,65 +183,21 @@ switch ($action) {
if ($msg == '') {
$c = ORM::for_table('tbl_user_recharges')->where('username', $username)->find_one();
if ($c) {
$mikrotik = Router::_info($c['routers']);
$mikrotik = Mikrotik::info($c['routers']);
if ($c['type'] == 'Hotspot') {
if(!$_c['radius_mode']){
try {
$iport = explode(":", $mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>" . $e->getMessage());
}
$printRequest = new RouterOS\Request('/ip/hotspot/user/print');
$printRequest->setArgument('.proplist', '.id');
$printRequest->setQuery(RouterOS\Query::where('name', $c['username']));
$id = $client->sendSync($printRequest)->getProperty('.id');
$setRequest = new RouterOS\Request('/ip/hotspot/user/set');
$setRequest->setArgument('numbers', $id);
$setRequest->setArgument('password', $password);
$client->sendSync($setRequest);
//remove hotspot active
$onlineRequest = new RouterOS\Request('/ip/hotspot/active/print');
$onlineRequest->setArgument('.proplist', '.id');
$onlineRequest->setQuery(RouterOS\Query::where('user', $c['username']));
$id = $client->sendSync($onlineRequest)->getProperty('.id');
$removeRequest = new RouterOS\Request('/ip/hotspot/active/remove');
$removeRequest->setArgument('numbers', $id);
$client->sendSync($removeRequest);
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']);
}
$d->password = $password;
$d->save();
} else {
if(!$_c['radius_mode']){
try {
$iport = explode(":", $mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>" . $e->getMessage());
}
$printRequest = new RouterOS\Request('/ppp/secret/print');
$printRequest->setArgument('.proplist', '.id');
$printRequest->setQuery(RouterOS\Query::where('name', $c['username']));
$id = $client->sendSync($printRequest)->getProperty('.id');
$setRequest = new RouterOS\Request('/ppp/secret/set');
$setRequest->setArgument('numbers', $id);
$setRequest->setArgument('password', $password);
$client->sendSync($setRequest);
//remove pppoe active
$onlineRequest = new RouterOS\Request('/ppp/active/print');
$onlineRequest->setArgument('.proplist', '.id');
$onlineRequest->setQuery(RouterOS\Query::where('name', $c['username']));
$id = $client->sendSync($onlineRequest)->getProperty('.id');
$removeRequest = new RouterOS\Request('/ppp/active/remove');
$removeRequest->setArgument('numbers', $id);
$client->sendSync($removeRequest);
if(!$config['radius_mode']){
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
Mikrotik::setPpoeUser($client,$c['username'],$password);
Mikrotik::removePpoeActive($client,$user['username']);
}
$d->password = $password;
@ -308,5 +228,5 @@ switch ($action) {
break;
default:
echo 'action not defined';
r2(U . 'customers/list', 'e', 'action not defined');
}

View File

@ -1,13 +1,12 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
**/
_admin();
$ui->assign('_title', $_L['Dashboard'].' - '. $config['CompanyName']);
$ui->assign('_title', $_L['Dashboard']);
$admin = Admin::_info();
$ui->assign('_admin', $admin);
if($admin['user_type'] != 'Admin' AND $admin['user_type'] != 'Sales'){
if(!in_array($admin['user_type'],['Admin','Sales'])){
r2(U."home",'e',$_L['Do_Not_Access']);
}
@ -72,4 +71,5 @@ foreach($tmp as $plan){
$ui->assign('stocks',$stocks);
$ui->assign('plans',$plans);
run_hook('view_dashboard'); #HOOK
$ui->display('dashboard.tpl');

View File

@ -1,6 +1,6 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
**/
r2(APP_URL.'/index.php?_route=dashboard');

View File

@ -1,9 +1,9 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
**/
_admin();
$ui->assign('_title', $_L['Reports'].'- '. $config['CompanyName']);
$ui->assign('_title', $_L['Reports']);
$ui->assign('_sysfrm_menu', 'reports');
$action = $routes['1'];
@ -40,7 +40,7 @@ switch ($action) {
$ui->assign('dr',$xy);
$ui->assign('mdate',$mdate);
$ui->assign('recharged_on',$mdate);
run_hook('print_by_date'); #HOOK
$ui->display('print-by-date.tpl');
break;
@ -70,7 +70,7 @@ switch ($action) {
</div>
<div id="logo"><img id="image" src="system/uploads/logo.png" alt="logo" /></div>
</div>
<div id="header">'.$_L['All_Transactions_at_Date'].': '. date($_c['date_format'], strtotime($mdate)).'</div>
<div id="header">'.$_L['All_Transactions_at_Date'].': '. date($config['date_format'], strtotime($mdate)).'</div>
<table id="customers">
<tr>
<th>'.$_L['Username'].'</th>
@ -88,7 +88,7 @@ switch ($action) {
$username = $value['username'];
$plan_name = $value['plan_name'];
$type = $value['type'];
$price = $_c['currency_code'].' '. number_format($value['price'],0,$_c['dec_point'],$_c['thousands_sep']);
$price = $config['currency_code'].' '. number_format($value['price'],0,$config['dec_point'],$config['thousands_sep']);
$recharged_on = date( $config['date_format'], strtotime($value['recharged_on']));
$expiration = date( $config['date_format'], strtotime($value['expiration']));
$time = $value['time'];
@ -108,8 +108,8 @@ switch ($action) {
}
$html .= '</table>
<h4 class="text-uppercase text-bold">'.$_L['Total_Income'].':</h4>
<h3 class="sum">'.$_c['currency_code'].' '.number_format($xy,2,$_c['dec_point'],$_c['thousands_sep']).'</h3>';
<h3 class="sum">'.$config['currency_code'].' '.number_format($xy,2,$config['dec_point'],$config['thousands_sep']).'</h3>';
run_hook('print_pdf_by_date'); #HOOK
define('_MPDF_PATH','system/vendors/mpdf/');
require('system/vendors/mpdf/mpdf.php');
@ -201,7 +201,7 @@ EOF;
$ui->assign('fdate',$fdate);
$ui->assign('tdate',$tdate);
$ui->assign('stype',$stype);
run_hook('print_by_period'); #HOOK
$ui->display('print-by-period.tpl');
break;
@ -243,7 +243,7 @@ EOF;
</div>
<div id="logo"><img id="image" src="system/uploads/logo.png" alt="logo" /></div>
</div>
<div id="header">'.$_L['All_Transactions_at_Date'].': '.date( $_c['date_format'], strtotime($fdate)).' - ' .date( $_c['date_format'], strtotime($tdate)).'</div>
<div id="header">'.$_L['All_Transactions_at_Date'].': '.date( $config['date_format'], strtotime($fdate)).' - ' .date( $config['date_format'], strtotime($tdate)).'</div>
<table id="customers">
<tr>
<th>'.$_L['Username'].'</th>
@ -261,7 +261,7 @@ EOF;
$username = $value['username'];
$plan_name = $value['plan_name'];
$type = $value['type'];
$price = $_c['currency_code'].' '. number_format($value['price'],0,$_c['dec_point'],$_c['thousands_sep']);
$price = $config['currency_code'].' '. number_format($value['price'],0,$config['dec_point'],$config['thousands_sep']);
$recharged_on = date( $config['date_format'], strtotime($value['recharged_on']));
$expiration = date( $config['date_format'], strtotime($value['expiration']));
$time = $value['time'];
@ -281,8 +281,9 @@ EOF;
}
$html .= '</table>
<h4 class="text-uppercase text-bold">'.$_L['Total_Income'].':</h4>
<h3 class="sum">'.$_c['currency_code'].' '.number_format($xy,2,$_c['dec_point'],$_c['thousands_sep']).'</h3>';
<h3 class="sum">'.$config['currency_code'].' '.number_format($xy,2,$config['dec_point'],$config['thousands_sep']).'</h3>';
run_hook('pdf_by_period'); #HOOK
define('_MPDF_PATH','system/vendors/mpdf/');
require('system/vendors/mpdf/mpdf.php');

View File

@ -1,10 +1,10 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
**/
_auth();
$ui->assign('_title', $_L['Dashboard'] . ' - ' . $config['CompanyName']);
$ui->assign('_title', $_L['Dashboard']);
$user = User::_info();
$ui->assign('_user', $user);
@ -18,5 +18,5 @@ $ui->assign('unpaid', ORM::for_table('tbl_payment_gateway')
->where('username', $user['username'])
->where('status', 1)
->find_one());
run_hook('view_customer_dashboard'); #HOOK
$ui->display('user-dashboard.tpl');

View File

@ -1,7 +1,7 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
**/
@ -15,6 +15,7 @@ switch ($do) {
case 'post':
$username = _post('username');
$password = _post('password');
run_hook('customer_login'); #HOOK
if ($username != '' and $password != '') {
$d = ORM::for_table('tbl_customers')->where('username', $username)->find_one();
if ($d) {
@ -41,11 +42,8 @@ switch ($do) {
break;
case 'login-display':
$ui->display('login.tpl');
break;
default:
$ui->display('login.tpl');
run_hook('customer_view_login'); #HOOK
$ui->display('user-login.tpl');
break;
}

View File

@ -1,7 +1,8 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
**/
run_hook('customer_logout'); #HOOK
if (session_status() == PHP_SESSION_NONE) session_start();
session_destroy();
header('location: index.php');

View File

@ -1,16 +0,0 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
**/
_admin();
$ui->assign('_title', $_L['Private_Message'].'- '. $config['CompanyName']);
$ui->assign('_system_menu', 'message');
$action = $routes['1'];
$admin = Admin::_info();
$ui->assign('_admin', $admin);
switch ($action) {
default:
$ui->display('a404.tpl');
}

View File

@ -1,42 +1,52 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
**/
_auth();
$ui->assign('_system_menu', 'order');
$action = $routes['1'];
$user = User::_info();
$ui->assign('_user', $user);
switch ($action) {
case 'voucher':
$ui->assign('_title', $_L['Order_Voucher'] . ' - ' . $config['CompanyName']);
$ui->assign('_system_menu', 'voucher');
$ui->assign('_title', $_L['Order_Voucher']);
run_hook('customer_view_order'); #HOOK
$ui->display('user-order.tpl');
break;
case 'history':
$ui->assign('_system_menu', 'history');
$d = ORM::for_table('tbl_payment_gateway')
->where('username', $user['username'])
->order_by_desc('id')
->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') . ' - ' . $config['CompanyName']);
$ui->assign('_title', Lang::T('Order History'));
run_hook('customer_view_order_history'); #HOOK
$ui->display('user-orderHistory.tpl');
break;
case 'package':
$ui->assign('_title', 'Order PPOE Internet - ' . $config['CompanyName']);
if(empty($user['email'])){
r2(U . 'accounts/profile', 'e', Lang::T("Please enter your email address"));
}
$ui->assign('_title', 'Order Plan');
$ui->assign('_system_menu', 'package');
$routers = ORM::for_table('tbl_routers')->find_many();
$plans = ORM::for_table('tbl_plans')->where('enabled', '1')->find_many();
$ui->assign('routers', $routers);
$ui->assign('plans', $plans);
$ui->display('user-orderPackage.tpl');
run_hook('customer_view_order_plan'); #HOOK
$ui->display('user-orderPlan.tpl');
break;
case 'unpaid':
$d = ORM::for_table('tbl_payment_gateway')
->where('username', $user['username'])
->where('status', 1)
->find_one();
run_hook('customer_find_unpaid'); #HOOK
if ($d) {
if (empty($d['pg_url_payment'])) {
r2(U . "order/buy/" . $trx['routers_id'] . '/' . $trx['plan_id'], 'w', Lang::T("Checking payment"));
@ -51,6 +61,7 @@ switch ($action) {
$trx = ORM::for_table('tbl_payment_gateway')
->where('username', $user['username'])
->find_one($trxid);
run_hook('customer_view_payment'); #HOOK
// jika tidak ditemukan, berarti punya orang lain
if (empty($trx)) {
r2(U . "order/package", 'w', Lang::T("Payment not found"));
@ -63,11 +74,13 @@ switch ($action) {
if (!file_exists('system/paymentgateway/' . $trx['gateway'] . '.php')) {
r2(U . 'order/view/' . $trxid, 'e', Lang::T("No Payment Gateway Available"));
}
run_hook('customer_check_payment_status'); #HOOK
include 'system/paymentgateway/' . $trx['gateway'] . '.php';
call_user_func($trx['gateway'] . '_validate_config');
call_user_func($_c['payment_gateway'] . '_get_status', $trx, $user);
call_user_func($config['payment_gateway'] . '_get_status', $trx, $user);
} else if ($routes['3'] == 'cancel') {
run_hook('customer_cancel_payment'); #HOOK
$trx->pg_paid_response = '{}';
$trx->status = 4;
$trx->paid_date = date('Y-m-d H:i:s');
@ -89,18 +102,22 @@ switch ($action) {
$ui->assign('router', $router);
$ui->assign('plan', $plan);
$ui->assign('bandw', $bandw);
$ui->assign('_title', 'TRX #' . $trxid . ' - ' . $config['CompanyName']);
$ui->assign('_title', 'TRX #' . $trxid);
$ui->display('user-orderView.tpl');
break;
case 'buy':
if ($_c['payment_gateway'] == 'none') {
if(empty($user['email'])){
r2(U . 'accounts/profile', 'e', Lang::T("Please enter your email address"));
}
if ($config['payment_gateway'] == 'none') {
r2(U . 'home', 'e', Lang::T("No Payment Gateway Available"));
}
if (!file_exists('system/paymentgateway/' . $_c['payment_gateway'] . '.php')) {
if (!file_exists('system/paymentgateway/' . $config['payment_gateway'] . '.php')) {
r2(U . 'home', 'e', Lang::T("No Payment Gateway Available"));
}
include 'system/paymentgateway/' . $_c['payment_gateway'] . '.php';
call_user_func($_c['payment_gateway'] . '_validate_config');
run_hook('customer_buy_plan'); #HOOK
include 'system/paymentgateway/' . $config['payment_gateway'] . '.php';
call_user_func($config['payment_gateway'] . '_validate_config');
$router = ORM::for_table('tbl_routers')->where('enabled', '1')->find_one($routes['2'] * 1);
$plan = ORM::for_table('tbl_plans')->where('enabled', '1')->find_one($routes['3'] * 1);
@ -115,7 +132,7 @@ switch ($action) {
if ($d['pg_url_payment']) {
r2(U . "order/view/" . $d['id'], 'w', Lang::T("You already have unpaid transaction, cancel it or pay it."));
} else {
if ($_c['payment_gateway'] == $d['gateway']) {
if ($config['payment_gateway'] == $d['gateway']) {
$id = $d['id'];
} else {
$d->status = 4;
@ -126,7 +143,7 @@ switch ($action) {
if (empty($id)) {
$d = ORM::for_table('tbl_payment_gateway')->create();
$d->username = $user['username'];
$d->gateway = $_c['payment_gateway'];
$d->gateway = $config['payment_gateway'];
$d->plan_id = $plan['id'];
$d->plan_name = $plan['name_plan'];
$d->routers_id = $router['id'];
@ -138,7 +155,7 @@ switch ($action) {
$id = $d->id();
} else {
$d->username = $user['username'];
$d->gateway = $_c['payment_gateway'];
$d->gateway = $config['payment_gateway'];
$d->plan_id = $plan['id'];
$d->plan_name = $plan['name_plan'];
$d->routers_id = $router['id'];
@ -151,7 +168,7 @@ switch ($action) {
if (!$id) {
r2(U . "order/package/" . $d['id'], 'e', Lang::T("Failed to create Transaction.."));
} else {
call_user_func($_c['payment_gateway'] . '_create_transaction', $d, $user);
call_user_func($config['payment_gateway'] . '_create_transaction', $d, $user);
}
break;
default:

View File

@ -1,9 +1,9 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
**/
_auth();
$ui->assign('_title', $_L['Order_Voucher'].'- '. $config['CompanyName']);
$ui->assign('_title', $_L['Order_Voucher']);
$ui->assign('_system_menu', 'order');
$action = $routes['1'];
@ -13,6 +13,7 @@ $ui->assign('_user', $user);
if(file_exists(__DIR__."/../../pages/".str_replace(".","",$action).".html")){
$ui->assign("PageFile",$action);
$ui->assign("pageHeader",$action);
run_hook('customer_view_page'); #HOOK
$ui->display('user-pages.tpl');
}else
$ui->display('404.tpl');

View File

@ -1,9 +1,9 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
**/
_admin();
$ui->assign('_title', 'Pages - '. $config['CompanyName']);
$ui->assign('_title', 'Pages');
$ui->assign('_system_menu', 'pages');
$action = $routes['1'];
@ -13,6 +13,7 @@ $ui->assign('_admin', $admin);
if(strpos($action,"-post")===false){
$path = __DIR__."/../../pages/".str_replace(".","",$action).".html";
//echo $path;
run_hook('view_edit_pages'); #HOOK
if(file_exists($path)){
$html = file_get_contents($path);
$ui->assign("htmls",str_replace(["<div","</div>"],"",$html));
@ -27,6 +28,7 @@ if(strpos($action,"-post")===false){
$path = __DIR__."/../../pages/".str_replace(".","",$action).".html";
if(file_exists($path)){
$html = _post("html");
run_hook('save_pages'); #HOOK
if(file_put_contents($path, str_replace(["<div","</div>"],"",$html))){
r2(U . 'pages/'.$action, 's', $_L['Success_Save_Page']);
}else{

View File

@ -1,6 +1,6 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
**/
_admin();
$ui->assign('_system_menu', 'paymentgateway');
@ -48,7 +48,7 @@ if(file_exists('system/paymentgateway/'.$action.'.php')){
}
r2(U . 'paymentgateway', 's', Lang::T('Payment Gateway saved successfully'));
}
$ui->assign('_title', 'Payment Gateway Settings - '. $config['CompanyName']);
$ui->assign('_title', 'Payment Gateway Settings');
$ui->assign('pgs', $pgs);
$ui->display('paymentgateway.tpl');
}

View File

@ -0,0 +1,7 @@
<?php
if(function_exists($routes[1])){
call_user_func($routes[1]);
}else{
r2(U.'dashboard', 'e', 'Function not found');
}

View File

@ -0,0 +1,124 @@
<?php
/**
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
**/
_admin();
$ui->assign('_title', $_L['Plugin Manager']);
$ui->assign('_system_menu', 'settings');
$plugin_repository = 'https://hotspotbilling.github.io/Plugin-Repository/repository.json';
$action = $routes['1'];
$admin = Admin::_info();
$ui->assign('_admin', $admin);
if ($admin['user_type'] != 'Admin') {
r2(U . "dashboard", 'e', $_L['Do_Not_Access']);
}
$cache = File::pathFixer('system/cache/plugin_repository.json');
if (file_exists($cache) && time() - filemtime($cache) > (24 * 60 * 60)) {
$json = json_decode(file_get_contents($cache), true);
} else {
$data = file_get_contents($plugin_repository);
file_put_contents($cache, $data);
$json = json_decode($data, true);
}
switch ($action) {
case 'install':
if(!is_writeable(File::pathFixer('system/cache/'))){
r2(U . "pluginmanager", 'e', 'Folder system/cache/ is not writable');
}
if(!is_writeable(File::pathFixer('system/plugin/'))){
r2(U . "pluginmanager", 'e', 'Folder system/plugin/ is not writable');
}
set_time_limit(-1);
$tipe = $routes['2'];
$plugin = $routes['3'];
$file = File::pathFixer('system/cache/') . $plugin . '.zip';
if (file_exists($file)) unlink($file);
if ($tipe == 'plugin') {
foreach ($json['plugins'] as $plg) {
if ($plg['id'] == $plugin) {
$fp = fopen($file, 'w+');
$ch = curl_init($plg['github'].'/archive/refs/heads/master.zip');
curl_setopt($ch, CURLOPT_POST, 0);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 15);
curl_setopt($ch, CURLOPT_TIMEOUT, 15);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_exec($ch);
curl_close($ch);
fclose($fp);
$zip = new ZipArchive();
$zip->open($file);
$zip->extractTo(File::pathFixer('system/cache/'));
$zip->close();
$folder = File::pathFixer('system/cache/' . $plugin.'-main/');
if(!file_exists($folder)){
$folder = File::pathFixer('system/cache/' . $plugin.'-master/');
}
if(!file_exists($folder)){
r2(U . "pluginmanager", 'e', 'Extracted Folder is unknown');
}
File::copyFolder($folder, File::pathFixer('system/plugin/'), ['README.md','LICENSE']);
File::deleteFolder($folder);
unlink($file);
r2(U . "pluginmanager", 's', 'Plugin '.$plugin.' has been installed');
break;
}
}
break;
} else if ($tipe == 'payment') {
foreach ($json['payment_gateway'] as $plg) {
if ($plg['id'] == $plugin) {
$fp = fopen($file, 'w+');
$ch = curl_init($plg['github'].'/archive/refs/heads/master.zip');
curl_setopt($ch, CURLOPT_POST, 0);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 15);
curl_setopt($ch, CURLOPT_TIMEOUT, 15);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_exec($ch);
curl_close($ch);
fclose($fp);
$zip = new ZipArchive();
$zip->open($file);
$zip->extractTo(File::pathFixer('system/cache/'));
$zip->close();
$folder = File::pathFixer('system/cache/' . $plugin.'-main/');
if(!file_exists($folder)){
$folder = File::pathFixer('system/cache/' . $plugin.'-master/');
}
if(!file_exists($folder)){
r2(U . "pluginmanager", 'e', 'Extracted Folder is unknown');
}
File::copyFolder($folder, File::pathFixer('system/paymentgateway/'), ['README.md','LICENSE']);
File::deleteFolder($folder);
unlink($file);
r2(U . "paymentgateway", 's', 'Payment Gateway '.$plugin.' has been installed');
break;
}
}
break;
}
default:
if (class_exists('ZipArchive')) {
$zipExt = true;
} else {
$zipExt = false;
}
$ui->assign('zipExt', $zipExt);
$ui->assign('plugins', $json['plugins']);
$ui->assign('pgs', $json['payment_gateway']);
$ui->display('plugin-manager.tpl');
}

View File

@ -1,16 +0,0 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
**/
_auth();
$ui->assign('_title', $_L['Private_Message'].'- '. $config['CompanyName']);
$ui->assign('_system_menu', 'pm');
$action = $routes['1'];
$user = User::_info();
$ui->assign('_user', $user);
switch ($action) {
default:
$ui->display('404.tpl');
}

View File

@ -1,83 +1,72 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
**/
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
**/
_admin();
$ui->assign('_title', $_L['Network'].' - '. $config['CompanyName']);
$ui->assign('_title', $_L['Network']);
$ui->assign('_system_menu', 'network');
$action = $routes['1'];
$admin = Admin::_info();
$ui->assign('_admin', $admin);
if($admin['user_type'] != 'Admin'){
r2(U."dashboard",'e',$_L['Do_Not_Access']);
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':
$ui->assign('xfooter', '<script type="text/javascript" src="ui/lib/c/pool.js"></script>');
$ui->assign('xfooter', '<script type="text/javascript" src="ui/lib/c/pool.js"></script>');
$name = _post('name');
if ($name != ''){
$paginator = Paginator::bootstrap('tbl_pool','pool_name','%'.$name.'%');
$d = ORM::for_table('tbl_pool')->where_like('pool_name','%'.$name.'%')->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_desc('id')->find_many();
}else{
$paginator = Paginator::bootstrap('tbl_pool');
$d = ORM::for_table('tbl_pool')->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_desc('id')->find_many();
}
$name = _post('name');
if ($name != '') {
$paginator = Paginator::bootstrap('tbl_pool', 'pool_name', '%' . $name . '%');
$d = ORM::for_table('tbl_pool')->where_like('pool_name', '%' . $name . '%')->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_desc('id')->find_many();
} else {
$paginator = Paginator::bootstrap('tbl_pool');
$d = ORM::for_table('tbl_pool')->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_desc('id')->find_many();
}
$ui->assign('d',$d);
$ui->assign('paginator',$paginator);
$ui->assign('d', $d);
$ui->assign('paginator', $paginator);
run_hook('view_pool'); #HOOK
$ui->display('pool.tpl');
break;
case 'add':
$r = ORM::for_table('tbl_routers')->find_many();
$ui->assign('r',$r);
$ui->display('pool-add.tpl');
$r = ORM::for_table('tbl_routers')->find_many();
$ui->assign('r', $r);
run_hook('view_add_pool'); #HOOK
$ui->display('pool-add.tpl');
break;
case 'edit':
$id = $routes['2'];
$d = ORM::for_table('tbl_pool')->find_one($id);
if($d){
$ui->assign('d',$d);
if ($d) {
$ui->assign('d', $d);
run_hook('view_edit_pool'); #HOOK
$ui->display('pool-edit.tpl');
}else{
} else {
r2(U . 'pool/list', 'e', $_L['Account_Not_Found']);
}
break;
case 'delete':
$id = $routes['2'];
run_hook('delete_pool'); #HOOK
$d = ORM::for_table('tbl_pool')->find_one($id);
$mikrotik = Router::_info($d['routers']);
if($d){
if(!$_c['radius_mode']){
try {
$iport = explode(":",$mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'],($iport[1])?$iport[1]:null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>".$e->getMessage());
}
$printRequest = new RouterOS\Request(
'/ip pool print .proplist=name',
RouterOS\Query::where('name', $d['pool_name'])
);
$poolName = $client->sendSync($printRequest)->getProperty('name');
$removeRequest = new RouterOS\Request('/ip/pool/remove');
$client($removeRequest
->setArgument('numbers', $poolName)
);
$mikrotik = Mikrotik::info($d['routers']);
if ($d) {
if (!$config['radius_mode']) {
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
Mikrotik::removePool($client, $d['pool_name']);
}
$d->delete();
r2(U . 'pool/list', 's', $_L['Delete_Successfully']);
@ -87,103 +76,74 @@ switch ($action) {
case 'add-post':
$name = _post('name');
$ip_address = _post('ip_address');
$routers = _post('routers');
$routers = _post('routers');
run_hook('add_pool'); #HOOK
$msg = '';
if(Validator::Length($name,30,2) == false){
$msg .= 'Name should be between 3 to 30 characters'. '<br>';
if (Validator::Length($name, 30, 2) == false) {
$msg .= 'Name should be between 3 to 30 characters' . '<br>';
}
if ($ip_address == '' or $routers == '') {
$msg .= $_L['All_field_is_required'] . '<br>';
}
if ($ip_address == '' OR $routers == ''){
$msg .= $_L['All_field_is_required']. '<br>';
}
$d = ORM::for_table('tbl_pool')->where('pool_name',$name)->find_one();
if($d){
$msg .= $_L['Pool_already_exist']. '<br>';
$d = ORM::for_table('tbl_pool')->where('pool_name', $name)->find_one();
if ($d) {
$msg .= $_L['Pool_already_exist'] . '<br>';
}
$mikrotik = Router::_info($routers);
if($msg == ''){
if(!$_c['radius_mode']){
try {
$iport = explode(":",$mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'],($iport[1])?$iport[1]:null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>".$e->getMessage());
}
$addRequest = new RouterOS\Request('/ip/pool/add');
$client->sendSync($addRequest
->setArgument('name', $name)
->setArgument('ranges', $ip_address)
);
$mikrotik = Mikrotik::info($routers);
if ($msg == '') {
if (!$config['radius_mode']) {
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
Mikrotik::addPool($client, $name, $ip_address);
}
$b = ORM::for_table('tbl_pool')->create();
$b->pool_name = $name;
$b->range_ip = $ip_address;
$b->routers = $routers;
$b->routers = $routers;
$b->save();
r2(U . 'pool/list', 's', $_L['Created_Successfully']);
}else{
} else {
r2(U . 'pool/add', 'e', $msg);
}
break;
case 'edit-post':
$name = _post('name');
$ip_address = _post('ip_address');
$routers = _post('routers');
run_hook('edit_pool'); #HOOK
$msg = '';
if(Validator::Length($name,30,2) == false){
$msg .= 'Name should be between 3 to 30 characters'. '<br>';
if ($ip_address == '' or $routers == '') {
$msg .= $_L['All_field_is_required'] . '<br>';
}
if ($ip_address == '' OR $routers == ''){
$msg .= $_L['All_field_is_required']. '<br>';
}
$id = _post('id');
$d = ORM::for_table('tbl_pool')->find_one($id);
if($d){
}else{
$msg .= $_L['Data_Not_Found']. '<br>';
if ($d) {
} else {
$msg .= $_L['Data_Not_Found'] . '<br>';
}
$mikrotik = Router::_info($routers);
if($msg == ''){
if(!$_c['radius_mode']){
try {
$iport = explode(":",$mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'],($iport[1])?$iport[1]:null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>".$e->getMessage());
}
$printRequest = new RouterOS\Request(
'/ip pool print .proplist=name',
RouterOS\Query::where('name', $name)
);
$poolName = $client->sendSync($printRequest)->getProperty('name');
$setRequest = new RouterOS\Request('/ip/pool/set');
$client($setRequest
->setArgument('numbers', $poolName)
->setArgument('ranges', $ip_address)
);
$mikrotik = Mikrotik::info($routers);
if ($msg == '') {
if (!$config['radius_mode']) {
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
Mikrotik::setPool($client, $d['pool_name'], $ip_address);
}
$d->pool_name = $name;
$d->range_ip = $ip_address;
$d->routers = $routers;
$d->routers = $routers;
$d->save();
r2(U . 'pool/list', 's', $_L['Updated_Successfully']);
}else{
r2(U . 'pool/edit/'.$id, 'e', $msg);
} else {
r2(U . 'pool/edit/' . $id, 'e', $msg);
}
break;
default:
echo 'action not defined';
}
}

View File

@ -1,13 +1,13 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
* @copyright Copyright (C) 2014-2015 PHP Mikrotik Billing
* @license GNU General Public License version 2 or later; see LICENSE.txt
**/
_admin();
$ui->assign('_title', $_L['Recharge_Account'] . ' - ' . $config['CompanyName']);
$ui->assign('_title', $_L['Recharge_Account']);
$ui->assign('_system_menu', 'prepaid');
$action = $routes['1'];
@ -37,6 +37,7 @@ switch ($action) {
$ui->assign('d', $d);
$ui->assign('paginator', $paginator);
run_hook('view_list_billing'); #HOOK
$ui->display('prepaid.tpl');
break;
@ -47,7 +48,7 @@ switch ($action) {
$ui->assign('p', $p);
$r = ORM::for_table('tbl_routers')->where('enabled', '1')->find_many();
$ui->assign('r', $r);
run_hook('view_recharge'); #HOOK
$ui->display('recharge.tpl');
break;
@ -61,7 +62,7 @@ switch ($action) {
$ui->assign('p', $p);
$r = ORM::for_table('tbl_routers')->where('enabled', '1')->find_many();
$ui->assign('r', $r);
run_hook('view_recharge_customer'); #HOOK
$ui->display('recharge-user.tpl');
break;
@ -85,7 +86,7 @@ switch ($action) {
$p = ORM::for_table('tbl_plans')->where('id', $plan)->where('enabled', '1')->find_one();
$b = ORM::for_table('tbl_user_recharges')->where('customer_id', $id_customer)->find_one();
$mikrotik = Router::_info($server);
$mikrotik = Mikrotik::info($server);
if($p['validity_unit']=='Months'){
$date_exp = date("Y-m-d", strtotime('+'.$p['validity'].' month'));
}else if($p['validity_unit']=='Days'){
@ -99,83 +100,13 @@ switch ($action) {
$date_exp = $datetime[0];
$time = $datetime[1];
}
run_hook('recharge_customer'); #HOOK
if ($type == 'Hotspot') {
if ($b) {
if(!$_c['radius_mode']){
try {
$iport = explode(":", $mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>".$e->getMessage());
}
$printRequest = new RouterOS\Request(
'/ip hotspot user print .proplist=name',
RouterOS\Query::where('name', $c['username'])
);
$userName = $client->sendSync($printRequest)->getProperty('name');
$removeRequest = new RouterOS\Request('/ip/hotspot/user/remove');
$client(
$removeRequest
->setArgument('numbers', $userName)
);
/* iBNuX Added:
* Time limit to Mikrotik
* 'Time_Limit', 'Data_Limit', 'Both_Limit'
*/
$addRequest = new RouterOS\Request('/ip/hotspot/user/add');
if ($p['typebp'] == "Limited") {
if ($p['limit_type'] == "Time_Limit") {
if ($p['time_unit'] == 'Hrs')
$timelimit = $p['time_limit'] . ":00:00";
else
$timelimit = "00:" . $p['time_limit'] . ":00";
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-uptime', $timelimit)
);
} else if ($p['limit_type'] == "Data_Limit") {
if ($p['data_unit'] == 'GB')
$datalimit = $p['data_limit'] . "000000000";
else
$datalimit = $p['data_limit'] . "000000";
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-bytes-total', $datalimit)
);
} else if ($p['limit_type'] == "Both_Limit") {
if ($p['time_unit'] == 'Hrs')
$timelimit = $p['time_limit'] . ":00:00";
else
$timelimit = "00:" . $p['time_limit'] . ":00";
if ($p['data_unit'] == 'GB')
$datalimit = $p['data_limit'] . "000000000";
else
$datalimit = $p['data_limit'] . "000000";
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-uptime', $timelimit)
->setArgument('limit-bytes-total', $datalimit)
);
}
} else {
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
);
}
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 = $id_customer;
@ -205,70 +136,9 @@ switch ($action) {
$t->type = "Hotspot";
$t->save();
} else {
if(!$_c['radius_mode']){
try {
$iport = explode(":", $mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>".$e->getMessage());
}
/* iBNuX Added:
* Time limit to Mikrotik
* 'Time_Limit', 'Data_Limit', 'Both_Limit'
*/
$addRequest = new RouterOS\Request('/ip/hotspot/user/add');
if ($p['typebp'] == "Limited") {
if ($p['limit_type'] == "Time_Limit") {
if ($p['time_unit'] == 'Hrs')
$timelimit = $p['time_limit'] . ":00:00";
else
$timelimit = "00:" . $p['time_limit'] . ":00";
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-uptime', $timelimit)
);
} else if ($p['limit_type'] == "Data_Limit") {
if ($p['data_unit'] == 'GB')
$datalimit = $p['data_limit'] . "000000000";
else
$datalimit = $p['data_limit'] . "000000";
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-bytes-total', $datalimit)
);
} else if ($p['limit_type'] == "Both_Limit") {
if ($p['time_unit'] == 'Hrs')
$timelimit = $p['time_limit'] . ":00:00";
else
$timelimit = "00:" . $p['time_limit'] . ":00";
if ($p['data_unit'] == 'GB')
$datalimit = $p['data_limit'] . "000000000";
else
$datalimit = $p['data_limit'] . "000000";
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-uptime', $timelimit)
->setArgument('limit-bytes-total', $datalimit)
);
}
} else {
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
);
}
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();
@ -299,39 +169,16 @@ switch ($action) {
$t->type = "Hotspot";
$t->save();
}
sendTelegram( "$admin[fullname] #Recharge Voucher #Hotspot for #u$c[username]\n".$p['name_plan'].
Message::sendTelegram( "$admin[fullname] #Recharge Voucher #Hotspot for #u$c[username]\n".$p['name_plan'].
"\nRouter: ".$server.
"\nPrice: ".$p['price']);
} else {
if ($b) {
if(!$_c['radius_mode']){
try {
$iport = explode(":", $mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>".$e->getMessage());
}
$printRequest = new RouterOS\Request(
'/ppp secret print .proplist=name',
RouterOS\Query::where('name', $c['username'])
);
$userName = $client->sendSync($printRequest)->getProperty('name');
$removeRequest = new RouterOS\Request('/ppp/secret/remove');
$client(
$removeRequest
->setArgument('numbers', $userName)
);
$addRequest = new RouterOS\Request('/ppp/secret/add');
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('service', 'pppoe')
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
);
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 = $id_customer;
@ -361,21 +208,9 @@ switch ($action) {
$t->type = "PPPOE";
$t->save();
} else {
if(!$_c['radius_mode']){
try {
$iport = explode(":", $mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>".$e->getMessage());
}
$addRequest = new RouterOS\Request('/ppp/secret/add');
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('service', 'pppoe')
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
);
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();
@ -406,7 +241,7 @@ switch ($action) {
$t->type = "PPPOE";
$t->save();
}
sendTelegram( "$admin[fullname] #Recharge Voucher #PPPOE for #u$c[username]\n".$p['name_plan'].
Message::sendTelegram( "$admin[fullname] #Recharge Voucher #PPPOE for #u$c[username]\n".$p['name_plan'].
"\nRouter: ".$server.
"\nPrice: ".$p['price']);
}
@ -414,9 +249,9 @@ switch ($action) {
$in = ORM::for_table('tbl_transactions')->where('username', $c['username'])->order_by_desc('id')->find_one();
$ui->assign('in', $in);
sendWhatsapp($c['username'], "*$_c[CompanyName]*\n".
"$_c[address]\n".
"$_c[phone]\n".
$msg = "*$config[CompanyName]*\n".
"$config[address]\n".
"$config[phone]\n".
"\n\n".
"INVOICE: *$in[invoice]*\n".
"$_L[Date] : $date_now\n".
@ -424,14 +259,19 @@ switch ($action) {
"\n\n".
"$_L[Type] : *$in[type]*\n".
"$_L[Plan_Name] : *$in[plan_name]*\n".
"$_L[Plan_Price] : *$_c[currency_code] ".number_format($in['price'],2,$_c['dec_point'],$_c['thousands_sep'])."*\n\n".
"$_L[Plan_Price] : *$config[currency_code] ".number_format($in['price'],2,$config['dec_point'],$config['thousands_sep'])."*\n\n".
"$_L[Username] : *$in[username]*\n".
"$_L[Password] : **********\n\n".
"$_L[Created_On] :\n*".date($_c['date_format'], strtotime($in['recharged_on']))." $in[time]*\n".
"$_L[Expires_On] :\n*".date($_c['date_format'], strtotime($in['expiration']))." $in[time]*\n".
"$_L[Created_On] :\n*".date($config['date_format'], strtotime($in['recharged_on']))." $in[time]*\n".
"$_L[Expires_On] :\n*".date($config['date_format'], strtotime($in['expiration']))." $in[time]*\n".
"\n\n".
"$_c[note]");
"$config[note]";
if ($_c['user_notification_payment'] == 'sms') {
Message::sendSMS($c['phonenumber'], $msg);
} else if ($_c['user_notification_payment'] == 'wa') {
Message::sendWhatsapp($c['phonenumber'], $msg);
}
$ui->assign('date', $date_now);
$ui->display('invoice.tpl');
@ -448,9 +288,9 @@ switch ($action) {
$ui->assign('d', $d);
$ui->assign('date', $date_now);
run_hook('print_invoice'); #HOOK
$ui->display('invoice-print.tpl');
break;
break;
case 'edit':
$id = $routes['2'];
@ -459,7 +299,7 @@ switch ($action) {
$ui->assign('d', $d);
$p = ORM::for_table('tbl_plans')->where('enabled', '1')->find_many();
$ui->assign('p', $p);
run_hook('view_edit_customer_plan'); #HOOK
$ui->display('prepaid-edit.tpl');
} else {
r2(U . 'services/list', 'e', $_L['Account_Not_Found']);
@ -470,48 +310,20 @@ switch ($action) {
$id = $routes['2'];
$d = ORM::for_table('tbl_user_recharges')->find_one($id);
$mikrotik = Router::_info($d['routers']);
$mikrotik = Mikrotik::info($d['routers']);
if ($d) {
run_hook('delete_customer_active_plan'); #HOOK
if ($d['type'] == 'Hotspot') {
if(!$_c['radius_mode']){
try {
$iport = explode(":", $mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>".$e->getMessage());
}
$printRequest = new RouterOS\Request(
'/ip hotspot user print .proplist=name',
RouterOS\Query::where('name', $d['username'])
);
$userName = $client->sendSync($printRequest)->getProperty('name');
$removeRequest = new RouterOS\Request('/ip/hotspot/user/remove');
$client(
$removeRequest
->setArgument('numbers', $userName)
);
if(!$config['radius_mode']){
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
Mikrotik::removeHotspotUser($client,$c['username']);
}
$d->delete();
} else {
if(!$_c['radius_mode']){
try {
$iport = explode(":", $mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>".$e->getMessage());
}
$printRequest = new RouterOS\Request(
'/ppp secret print .proplist=name',
RouterOS\Query::where('name', $d['username'])
);
$userName = $client->sendSync($printRequest)->getProperty('name');
$removeRequest = new RouterOS\Request('/ppp/secret/remove');
$client(
$removeRequest
->setArgument('numbers', $userName)
);
if(!$config['radius_mode']){
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
Mikrotik::removePpoeUser($client,$c['username']);
}
$d->delete();
}
@ -533,12 +345,13 @@ switch ($action) {
}
if ($msg == '') {
run_hook('edit_customer_plan'); #HOOK
$d->username = $username;
$d->plan_id = $id_plan;
$d->recharged_on = $recharged_on;
$d->expiration = $expiration;
$d->save();
//TODO set mikrotik for editedd plan
r2(U . 'prepaid/list', 's', $_L['Updated_Successfully']);
} else {
r2(U . 'prepaid/edit/' . $id, 'e', $msg);
@ -568,6 +381,7 @@ switch ($action) {
$ui->assign('d', $d);
$ui->assign('paginator', $paginator);
run_hook('view_list_voucher'); #HOOK
$ui->display('voucher.tpl');
break;
@ -579,7 +393,7 @@ switch ($action) {
$ui->assign('p', $p);
$r = ORM::for_table('tbl_routers')->where('enabled', '1')->find_many();
$ui->assign('r', $r);
run_hook('view_add_voucher'); #HOOK
$ui->display('voucher-add.tpl');
break;
@ -643,7 +457,7 @@ switch ($action) {
->count();
}
$ui->assign('_title', $_L['Voucher_Hotspot'] . ' - ' . $config['CompanyName']);
$ui->assign('_title', $_L['Voucher_Hotspot']);
$ui->assign('from_id', $from_id);
$ui->assign('pagebreak', $pagebreak);
@ -657,7 +471,7 @@ switch ($action) {
//for counting pagebreak
$ui->assign('jml', 0);
run_hook('view_print_voucher'); #HOOK
$ui->display('print-voucher.tpl');
break;
case 'voucher-post':
@ -678,9 +492,10 @@ switch ($action) {
$msg .= 'The Length Code must be a number' . '<br>';
}
if ($msg == '') {
run_hook('create_voucher'); #HOOK
for ($i = 0; $i < $numbervoucher; $i++) {
$code = strtoupper(substr(md5(time() . rand(10000, 99999)), 0, $lengthcode));
//TODO: IMPLEMENT Voucher Generator
$d = ORM::for_table('tbl_voucher')->create();
$d->type = $type;
$d->routers = $server;
@ -699,7 +514,7 @@ switch ($action) {
case 'voucher-delete':
$id = $routes['2'];
run_hook('delete_voucher'); #HOOK
$d = ORM::for_table('tbl_voucher')->find_one($id);
if ($d) {
$d->delete();
@ -708,11 +523,11 @@ switch ($action) {
break;
case 'refill':
$ui->assign('xfooter', '<script type="text/javascript" src="' . $_theme . '/scripts/form-elements.init.js"></script>');
$ui->assign('xfooter', '<script type="text/javascript" src="ui/ui/scripts/form-elements.init.js"></script>');
$c = ORM::for_table('tbl_customers')->find_many();
$ui->assign('c', $c);
run_hook('view_refill'); #HOOK
$ui->display('refill.tpl');
break;
@ -731,7 +546,7 @@ switch ($action) {
$date_only = date("Y-m-d");
$time = date("H:i:s");
$mikrotik = Router::_info($v1['routers']);
$mikrotik = Mikrotik::info($v1['routers']);
if($p['validity_unit']=='Months'){
$date_exp = date("Y-m-d", strtotime('+'.$p['validity'].' month'));
@ -746,83 +561,14 @@ switch ($action) {
$date_exp = $datetime[0];
$time = $datetime[1];
}
run_hook('refill_customer'); #HOOK
if ($v1) {
if ($v1['type'] == 'Hotspot') {
if ($b) {
if(!$_c['radius_mode']){
try {
$iport = explode(":", $mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>".$e->getMessage());
}
$printRequest = new RouterOS\Request(
'/ip hotspot user print .proplist=name',
RouterOS\Query::where('name', $c['username'])
);
$userName = $client->sendSync($printRequest)->getProperty('name');
$removeRequest = new RouterOS\Request('/ip/hotspot/user/remove');
$client(
$removeRequest
->setArgument('numbers', $userName)
);
/* iBNuX Added:
* Time limit to Mikrotik
* 'Time_Limit', 'Data_Limit', 'Both_Limit'
*/
$addRequest = new RouterOS\Request('/ip/hotspot/user/add');
if ($p['typebp'] == "Limited") {
if ($p['limit_type'] == "Time_Limit") {
if ($p['time_unit'] == 'Hrs')
$timelimit = $p['time_limit'] . ":00:00";
else
$timelimit = "00:" . $p['time_limit'] . ":00";
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-uptime', $timelimit)
);
} else if ($p['limit_type'] == "Data_Limit") {
if ($p['data_unit'] == 'GB')
$datalimit = $p['data_limit'] . "000000000";
else
$datalimit = $p['data_limit'] . "000000";
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-bytes-total', $datalimit)
);
} else if ($p['limit_type'] == "Both_Limit") {
if ($p['time_unit'] == 'Hrs')
$timelimit = $p['time_limit'] . ":00:00";
else
$timelimit = "00:" . $p['time_limit'] . ":00";
if ($p['data_unit'] == 'GB')
$datalimit = $p['data_limit'] . "000000000";
else
$datalimit = $p['data_limit'] . "000000";
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-uptime', $timelimit)
->setArgument('limit-bytes-total', $datalimit)
);
}
} else {
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
);
}
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;
@ -852,69 +598,9 @@ switch ($action) {
$t->type = "Hotspot";
$t->save();
} else {
if(!$_c['radius_mode']){
try {
$iport = explode(":", $mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>".$e->getMessage());
}
/* iBNuX Added:
* Time limit to Mikrotik
* 'Time_Limit', 'Data_Limit', 'Both_Limit'
*/
$addRequest = new RouterOS\Request('/ip/hotspot/user/add');
if ($p['typebp'] == "Limited") {
if ($p['limit_type'] == "Time_Limit") {
if ($p['time_unit'] == 'Hrs')
$timelimit = $p['time_limit'] . ":00:00";
else
$timelimit = "00:" . $p['time_limit'] . ":00";
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-uptime', $timelimit)
);
} else if ($p['limit_type'] == "Data_Limit") {
if ($p['data_unit'] == 'GB')
$datalimit = $p['data_limit'] . "000000000";
else
$datalimit = $p['data_limit'] . "000000";
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-bytes-total', $datalimit)
);
} else if ($p['limit_type'] == "Both_Limit") {
if ($p['time_unit'] == 'Hrs')
$timelimit = $p['time_limit'] . ":00:00";
else
$timelimit = "00:" . $p['time_limit'] . ":00";
if ($p['data_unit'] == 'GB')
$datalimit = $p['data_limit'] . "000000000";
else
$datalimit = $p['data_limit'] . "000000";
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-uptime', $timelimit)
->setArgument('limit-bytes-total', $datalimit)
);
}
} else {
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
);
}
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();
@ -950,39 +636,16 @@ switch ($action) {
$v1->user = $c['username'];
$v1->save();
sendTelegram( "$admin[fullname] #Refill #Voucher #Hotspot for #u$c[username]\n".$p['name_plan'].
Message::sendTelegram( "$admin[fullname] #Refill #Voucher #Hotspot for #u$c[username]\n".$p['name_plan'].
"\nCode: ".$code.
"\nRouter: ".$v1['routers'].
"\nPrice: ".$p['price']);
} else {
if ($b) {
if(!$_c['radius_mode']){
try {
$iport = explode(":", $mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>".$e->getMessage());
}
$printRequest = new RouterOS\Request(
'/ppp secret print .proplist=name',
RouterOS\Query::where('name', $c['username'])
);
$userName = $client->sendSync($printRequest)->getProperty('name');
$removeRequest = new RouterOS\Request('/ppp/secret/remove');
$client(
$removeRequest
->setArgument('numbers', $userName)
);
$addRequest = new RouterOS\Request('/ppp/secret/add');
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('service', 'pppoe')
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
);
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;
@ -1012,21 +675,9 @@ switch ($action) {
$t->type = "PPPOE";
$t->save();
} else {
if(!$_c['radius_mode']){
try {
$iport = explode(":", $mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>".$e->getMessage());
}
$addRequest = new RouterOS\Request('/ppp/secret/add');
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('service', 'pppoe')
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
);
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();
@ -1063,7 +714,7 @@ switch ($action) {
$v1->save();
sendTelegram( "$admin[fullname] Refill #Voucher #PPPOE for #u$c[username]\n".$p['name_plan'].
Message::sendTelegram( "$admin[fullname] Refill #Voucher #PPPOE for #u$c[username]\n".$p['name_plan'].
"\nCode: ".$code.
"\nRouter: ".$v1['routers'].
"\nPrice: ".$p['price']);
@ -1072,9 +723,9 @@ switch ($action) {
$ui->assign('in', $in);
sendWhatsapp($c['username'], "*$_c[CompanyName]*\n".
"$_c[address]\n".
"$_c[phone]\n".
$msg = "*$config[CompanyName]*\n".
"$config[address]\n".
"$config[phone]\n".
"\n\n".
"INVOICE: *$in[invoice]*\n".
"$_L[Date] : $date_now\n".
@ -1082,14 +733,19 @@ switch ($action) {
"\n\n".
"$_L[Type] : *$in[type]*\n".
"$_L[Plan_Name] : *$in[plan_name]*\n".
"$_L[Plan_Price] : *$_c[currency_code] ".number_format($in['price'],2,$_c['dec_point'],$_c['thousands_sep'])."*\n\n".
"$_L[Plan_Price] : *$config[currency_code] ".number_format($in['price'],2,$config['dec_point'],$config['thousands_sep'])."*\n\n".
"$_L[Username] : *$in[username]*\n".
"$_L[Password] : **********\n\n".
"$_L[Created_On] :\n*".date($_c['date_format'], strtotime($in['recharged_on']))." $in[time]*\n".
"$_L[Expires_On] :\n*".date($_c['date_format'], strtotime($in['expiration']))." $in[time]*\n".
"$_L[Created_On] :\n*".date($config['date_format'], strtotime($in['recharged_on']))." $in[time]*\n".
"$_L[Expires_On] :\n*".date($config['date_format'], strtotime($in['expiration']))." $in[time]*\n".
"\n\n".
"$_c[note]");
"$config[note]";
if ($_c['user_notification_payment'] == 'sms') {
Message::sendSMS($c['phonenumber'], $msg);
} else if ($_c['user_notification_payment'] == 'wa') {
Message::sendWhatsapp($c['phonenumber'], $msg);
}
$ui->assign('date', $date_now);
$ui->display('invoice.tpl');
} else {

View File

@ -1,7 +1,7 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
* @copyright Copyright (C) 2014-2015 PHP Mikrotik Billing
* @license GNU General Public License version 2 or later; see LICENSE.txt
*
@ -14,11 +14,7 @@ if (isset($routes['1'])) {
$do = 'register-display';
}
use PEAR2\Net\RouterOS;
require_once 'system/autoload/PEAR2/Autoload.php';
$otpPath = 'system/uploads/sms/';
$otpPath = 'system/cache/sms/';
switch ($do) {
case 'post':
@ -43,8 +39,9 @@ switch ($do) {
$msg .= $_L['PasswordsNotMatch'] . '<br>';
}
if(!empty($_c['sms_url'])){
if(!empty($config['sms_url'])){
$otpPath .= sha1($username.$db_password).".txt";
run_hook('validate_otp'); #HOOK
if(file_exists($otpPath) && time()-filemtime($otpPath)>300){
unlink($otpPath);
r2(U . 'register', 's', 'Verification code expired');
@ -74,6 +71,7 @@ switch ($do) {
$msg .= $_L['account_already_exist'] . '<br>';
}
if ($msg == '') {
run_hook('register_user'); #HOOK
$d = ORM::for_table('tbl_customers')->create();
$d->username = $username;
$d->password = $password;
@ -93,7 +91,8 @@ switch ($do) {
<span aria-hidden="true">×</span>
</button>
<div>Failed to register</div></div>');
r2(U . 'register', 's', 'Failed to register');
run_hook('view_otp_register'); #HOOK
$ui->display('register-rotp.tpl');
}
} else {
$ui->assign('username', $username);
@ -110,7 +109,7 @@ switch ($do) {
break;
default:
if(!empty($_c['sms_url'])){
if(!empty($config['sms_url'])){
$username = _post('username');
if(!empty($username)){
$d = ORM::for_table('tbl_customers')->where('username', $username)->find_one();
@ -133,7 +132,7 @@ switch ($do) {
}else{
$otp = rand(100000,999999);
file_put_contents($otpPath, $otp);
sendSMS($username,$_c['CompanyName']."\nYour Verification code are: $otp");
Message::sendSMS($username,$config['CompanyName']."\nYour Verification code are: $otp");
$ui->assign('username', $username);
$ui->assign('notify', '<div class="alert alert-success">
<button type="button" class="close" data-dismiss="alert">
@ -143,6 +142,7 @@ switch ($do) {
$ui->display('register-otp.tpl');
}
}else{
run_hook('view_otp_register'); #HOOK
$ui->display('register-rotp.tpl');
}
}else{
@ -150,6 +150,7 @@ switch ($do) {
$ui->assign('fullname', "");
$ui->assign('address', "");
$ui->assign('otp', false);
run_hook('view_register'); #HOOK
$ui->display('register.tpl');
}
break;

View File

@ -1,9 +1,9 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
**/
_admin();
$ui->assign('_title', $_L['Reports'].' - '. $config['CompanyName']);
$ui->assign('_title', $_L['Reports']);
$ui->assign('_system_menu', 'reports');
$action = $routes['1'];
@ -23,61 +23,62 @@ $before_30_days = date('Y-m-d', strtotime('today - 30 days'));
$month_n = date('n');
switch ($action) {
case 'by-date':
case 'daily-report':
$paginator = Paginator::bootstrap('tbl_transactions','recharged_on',$mdate);
$d = ORM::for_table('tbl_transactions')->where('recharged_on',$mdate)->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_desc('id')->find_many();
$dr = ORM::for_table('tbl_transactions')->where('recharged_on',$mdate)->sum('price');
$ui->assign('d',$d);
$ui->assign('dr',$dr);
$ui->assign('mdate',$mdate);
$ui->assign('mtime',$mtime);
$ui->assign('paginator',$paginator);
run_hook('view_daily_reports'); #HOOK
$ui->display('reports-daily.tpl');
break;
case 'by-period':
$ui->assign('mdate',$mdate);
$ui->assign('mtime',$mtime);
$ui->assign('tdate', $tdate);
run_hook('view_reports_by_period'); #HOOK
$ui->display('reports-period.tpl');
break;
case 'period-view':
$fdate = _post('fdate');
$tdate = _post('tdate');
$stype = _post('stype');
$d = ORM::for_table('tbl_transactions');
if ($stype != ''){
$d->where('type', $stype);
}
$d->where_gte('recharged_on', $fdate);
$d->where_lte('recharged_on', $tdate);
$d->order_by_desc('id');
$x = $d->find_many();
$dr = ORM::for_table('tbl_transactions');
if ($stype != ''){
$dr->where('type', $stype);
}
$dr->where_gte('recharged_on', $fdate);
$dr->where_lte('recharged_on', $tdate);
$xy = $dr->sum('price');
$ui->assign('d',$x);
$ui->assign('dr',$xy);
$ui->assign('fdate',$fdate);
$ui->assign('tdate',$tdate);
$ui->assign('stype',$stype);
run_hook('view_reports_period'); #HOOK
$ui->display('reports-period-view.tpl');
break;
default:
echo 'action not defined';
}

View File

@ -1,9 +1,9 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
**/
_admin();
$ui->assign('_title', $_L['Network'].' - '. $config['CompanyName']);
$ui->assign('_title', $_L['Network']);
$ui->assign('_system_menu', 'network');
$action = $routes['1'];
@ -33,12 +33,12 @@ switch ($action) {
$ui->assign('d',$d);
$ui->assign('paginator',$paginator);
run_hook('view_list_routers'); #HOOK
$ui->display('routers.tpl');
break;
case 'add':
$d = ORM::for_table('tbl_routers')->find_many();
$ui->assign('d',$d);
run_hook('view_add_routers'); #HOOK
$ui->display('routers-add.tpl');
break;
@ -47,6 +47,7 @@ switch ($action) {
$d = ORM::for_table('tbl_routers')->find_one($id);
if($d){
$ui->assign('d',$d);
run_hook('view_router_edit'); #HOOK
$ui->display('routers-edit.tpl');
}else{
r2(U . 'routers/list', 'e', $_L['Account_Not_Found']);
@ -55,7 +56,7 @@ switch ($action) {
case 'delete':
$id = $routes['2'];
run_hook('router_delete'); #HOOK
$d = ORM::for_table('tbl_routers')->find_one($id);
if($d){
$d->delete();
@ -84,16 +85,12 @@ switch ($action) {
$msg .= $_L['Router_already_exist']. '<br>';
}
if(!$_c['radius_mode']){
try {
$iport = explode(":", $ip_address);
$client = new RouterOS\Client($iport[0], $username, $password, ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
$msg .= "Unable to connect to the router.<br>".$e->getMessage().'<br>';
}
if(!$config['radius_mode']){
Mikrotik::getClient($ip_address,$username,$password);
}
if($msg == ''){
run_hook('add_router'); #HOOK
$d = ORM::for_table('tbl_routers')->create();
$d->name = $name;
$d->ip_address = $ip_address;
@ -149,17 +146,13 @@ switch ($action) {
}
if(!$_c['radius_mode']){
try {
$iport = explode(":", $ip_address);
$client = new RouterOS\Client($iport[0], $username, $password, ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
$msg .= "Unable to connect to the router.<br>".$e->getMessage().'<br>';
}
if(!$config['radius_mode']){
Mikrotik::getClient($ip_address,$username,$password);
}
if($msg == ''){
run_hook('router_edit'); #HOOK
$d->name = $name;
$d->ip_address = $ip_address;
$d->username = $username;

View File

@ -1,11 +1,11 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
**/
_admin();
$ui->assign('_title', $_L['Hotspot_Plans'] . ' - ' . $config['CompanyName']);
$ui->assign('_title', $_L['Hotspot_Plans']);
$ui->assign('_system_menu', 'services');
$action = $routes['1'];
@ -35,6 +35,7 @@ switch ($action) {
$ui->assign('d', $d);
$ui->assign('paginator', $paginator);
run_hook('view_list_plans'); #HOOK
$ui->display('hotspot.tpl');
break;
@ -43,7 +44,7 @@ switch ($action) {
$ui->assign('d', $d);
$r = ORM::for_table('tbl_routers')->find_many();
$ui->assign('r', $r);
run_hook('view_add_plan'); #HOOK
$ui->display('hotspot-add.tpl');
break;
@ -56,7 +57,7 @@ switch ($action) {
$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 {
r2(U . 'services/hotspot', 'e', $_L['Account_Not_Found']);
@ -68,25 +69,11 @@ switch ($action) {
$d = ORM::for_table('tbl_plans')->find_one($id);
if ($d) {
if(!$_c['radius_mode']){
$mikrotik = Router::_info($d['routers']);
try {
$iport = explode(":", $mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>".$e->getMessage());
}
$printRequest = new RouterOS\Request(
'/ip hotspot user profile print .proplist=name',
RouterOS\Query::where('name', $d['name_plan'])
);
$profileName = $client->sendSync($printRequest)->getProperty('name');
$removeRequest = new RouterOS\Request('/ip/hotspot/user/profile/remove');
$client(
$removeRequest
->setArgument('numbers', $profileName)
);
run_hook('delete_plan'); #HOOK
if(!$config['radius_mode']){
$mikrotik = Mikrotik::info($d['routers']);
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
Mikrotik::removeHotspotPlan($client,$d['name_plan']);
}
$d->delete();
@ -127,6 +114,8 @@ switch ($action) {
$msg .= $_L['Plan_already_exist'] . '<br>';
}
run_hook('add_plan'); #HOOK
if ($msg == '') {
$b = ORM::for_table('tbl_bandwidth')->where('id', $id_bw)->find_one();
if ($b['rate_down_unit'] == 'Kbps') {
@ -141,21 +130,10 @@ switch ($action) {
}
$rate = $b['rate_up'] . $unitup . "/" . $b['rate_down'] . $unitdown;
if(!$_c['radius_mode']){
$mikrotik = Router::_info($routers);
try {
$iport = explode(":", $mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>".$e->getMessage());
}
$addRequest = new RouterOS\Request('/ip/hotspot/user/profile/add');
$client->sendSync(
$addRequest
->setArgument('name', $name)
->setArgument('shared-users', $sharedusers)
->setArgument('rate-limit', $rate)
);
if(!$config['radius_mode']){
$mikrotik = Mikrotik::info($routers);
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
Mikrotik::addHotspotPlan($client, $name, $sharedusers, $rate);
}
$d = ORM::for_table('tbl_plans')->create();
@ -216,7 +194,7 @@ switch ($action) {
} else {
$msg .= $_L['Data_Not_Found'] . '<br>';
}
run_hook('edit_plan'); #HOOK
if ($msg == '') {
$b = ORM::for_table('tbl_bandwidth')->where('id', $id_bw)->find_one();
if ($b['rate_down_unit'] == 'Kbps') {
@ -231,27 +209,10 @@ switch ($action) {
}
$rate = $b['rate_up'] . $unitup . "/" . $b['rate_down'] . $unitdown;
if(!$_c['radius_mode']){
$mikrotik = Router::_info($routers);
try {
$iport = explode(":", $mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>".$e->getMessage());
}
$printRequest = new RouterOS\Request(
'/ip hotspot user profile print .proplist=name',
RouterOS\Query::where('name', $name)
);
$profileName = $client->sendSync($printRequest)->getProperty('name');
$setRequest = new RouterOS\Request('/ip/hotspot/user/profile/set');
$client(
$setRequest
->setArgument('numbers', $profileName)
->setArgument('shared-users', $sharedusers)
->setArgument('rate-limit', $rate)
);
if(!$config['radius_mode']){
$mikrotik = Mikrotik::info($routers);
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
Mikrotik::setHotspotPlan($client, $name, $sharedusers, $rate);
}
$d->name_plan = $name;
@ -290,6 +251,7 @@ switch ($action) {
$ui->assign('d', $d);
$ui->assign('paginator', $paginator);
run_hook('view_list_ppoe'); #HOOK
$ui->display('pppoe.tpl');
break;
@ -300,7 +262,7 @@ switch ($action) {
$ui->assign('p', $p);
$r = ORM::for_table('tbl_routers')->find_many();
$ui->assign('r', $r);
run_hook('view_add_ppoe'); #HOOK
$ui->display('pppoe-add.tpl');
break;
@ -315,7 +277,7 @@ switch ($action) {
$ui->assign('p', $p);
$r = ORM::for_table('tbl_routers')->find_many();
$ui->assign('r', $r);
run_hook('view_edit_ppoe'); #HOOK
$ui->display('pppoe-edit.tpl');
} else {
r2(U . 'services/pppoe', 'e', $_L['Account_Not_Found']);
@ -327,25 +289,11 @@ switch ($action) {
$d = ORM::for_table('tbl_plans')->find_one($id);
if ($d) {
if(!$_c['radius_mode']){
$mikrotik = Router::_info($d['routers']);
try {
$iport = explode(":", $mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>".$e->getMessage());
}
$printRequest = new RouterOS\Request(
'/ppp profile print .proplist=name',
RouterOS\Query::where('name', $d['name_plan'])
);
$profileName = $client->sendSync($printRequest)->getProperty('name');
$removeRequest = new RouterOS\Request('/ppp/profile/remove');
$client(
$removeRequest
->setArgument('numbers', $profileName)
);
run_hook('delete_ppoe'); #HOOK
if(!$config['radius_mode']){
$mikrotik = Mikrotik::info($d['routers']);
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
Mikrotik::removePpoePlan($client, $d['name_plan']);
}
$d->delete();
@ -378,7 +326,7 @@ switch ($action) {
if ($d) {
$msg .= $_L['Plan_already_exist'] . '<br>';
}
run_hook('add_ppoe'); #HOOK
if ($msg == '') {
$b = ORM::for_table('tbl_bandwidth')->where('id', $id_bw)->find_one();
if ($b['rate_down_unit'] == 'Kbps') {
@ -393,22 +341,10 @@ switch ($action) {
}
$rate = $b['rate_up'] . $unitup . "/" . $b['rate_down'] . $unitdown;
if(!$_c['radius_mode']){
$mikrotik = Router::_info($routers);
try {
$iport = explode(":", $mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>".$e->getMessage());
}
$addRequest = new RouterOS\Request('/ppp/profile/add');
$client->sendSync(
$addRequest
->setArgument('name', $name)
->setArgument('local-address', $pool)
->setArgument('remote-address', $pool)
->setArgument('rate-limit', $rate)
);
if(!$config['radius_mode']){
$mikrotik = Mikrotik::info($routers);
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
Mikrotik::addPpoePlan($client, $name, $pool, $rate);
}
$d = ORM::for_table('tbl_plans')->create();
@ -456,7 +392,7 @@ switch ($action) {
} else {
$msg .= $_L['Data_Not_Found'] . '<br>';
}
run_hook('edit_ppoe'); #HOOK
if ($msg == '') {
$b = ORM::for_table('tbl_bandwidth')->where('id', $id_bw)->find_one();
if ($b['rate_down_unit'] == 'Kbps') {
@ -471,28 +407,10 @@ switch ($action) {
}
$rate = $b['rate_up'] . $unitup . "/" . $b['rate_down'] . $unitdown;
if(!$_c['radius_mode']){
$mikrotik = Router::_info($routers);
try {
$iport = explode(":", $mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>".$e->getMessage());
}
$printRequest = new RouterOS\Request(
'/ppp profile print .proplist=name',
RouterOS\Query::where('name', $name)
);
$profileName = $client->sendSync($printRequest)->getProperty('name');
$setRequest = new RouterOS\Request('/ppp/profile/set');
$client(
$setRequest
->setArgument('numbers', $profileName)
->setArgument('local-address', $pool)
->setArgument('remote-address', $pool)
->setArgument('rate-limit', $rate)
);
if(!$config['radius_mode']){
$mikrotik = Mikrotik::info($routers);
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
Mikrotik::setPpoePlan($client, $name, $pool, $rate);
}
$d->name_plan = $name;

View File

@ -1,11 +1,11 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
**/
_admin();
$ui->assign('_title', $_L['Settings'] . '- ' . $config['CompanyName']);
$ui->assign('_title', $_L['Settings']);
$ui->assign('_system_menu', 'settings');
$action = $routes['1'];
@ -17,7 +17,7 @@ switch ($action) {
if ($admin['user_type'] != 'Admin') {
r2(U . "dashboard", 'e', $_L['Do_Not_Access']);
}
run_hook('view_app_settings'); #HOOK
$ui->display('app-settings.tpl');
break;
@ -31,6 +31,7 @@ switch ($action) {
$timezonelist = Timezone::timezoneList();
$ui->assign('tlist', $timezonelist);
$ui->assign('xjq', ' $("#tzone").select2(); ');
run_hook('view_localisation'); #HOOK
$ui->display('app-localisation.tpl');
break;
@ -52,6 +53,7 @@ switch ($action) {
$ui->assign('d', $d);
$ui->assign('paginator', $paginator);
run_hook('view_list_admin'); #HOOK
$ui->display('users.tpl');
break;
@ -59,7 +61,7 @@ switch ($action) {
if ($admin['user_type'] != 'Admin') {
r2(U . "dashboard", 'e', $_L['Do_Not_Access']);
}
run_hook('view_add_admin'); #HOOK
$ui->display('users-add.tpl');
break;
@ -72,6 +74,7 @@ switch ($action) {
$d = ORM::for_table('tbl_users')->find_one($id);
if ($d) {
$ui->assign('d', $d);
run_hook('view_edit_admin'); #HOOK
$ui->display('users-edit.tpl');
} else {
r2(U . 'settings/users', 'e', $_L['Account_Not_Found']);
@ -89,6 +92,7 @@ switch ($action) {
}
$d = ORM::for_table('tbl_users')->find_one($id);
if ($d) {
run_hook('delete_admin'); #HOOK
$d->delete();
r2(U . 'settings/users', 's', $_L['User_Delete_Ok']);
} else {
@ -121,6 +125,7 @@ switch ($action) {
$msg .= $_L['account_already_exist'] . '<br>';
}
$date_now = date("Y-m-d H:i:s");
run_hook('add_admin'); #HOOK
if ($msg == '') {
$password = Password::_crypt($password);
$d = ORM::for_table('tbl_users')->create();
@ -175,7 +180,7 @@ switch ($action) {
$msg .= $_L['account_already_exist'] . '<br>';
}
}
run_hook('edit_admin'); #HOOK
if ($msg == '') {
$d->username = $username;
if ($password != '') {
@ -200,13 +205,18 @@ switch ($action) {
case 'app-post':
$company = _post('company');
$footer = _post('footer');
$telegram_bot = _post('telegram_bot');
$telegram_target_id = _post('telegram_target_id');
$sms_url = _post('sms_url');
$wa_url = _post('wa_url');
$user_notification_expired = _post('user_notification_expired');
$user_notification_expired_text = _post('user_notification_expired_text');
$user_notification_payment = _post('user_notification_payment');
$address = _post('address');
$tawkto = _post('tawkto');
$radius_mode = _post('radius_mode')*1;
run_hook('save_settings'); #HOOK
if ($company == '') {
r2(U . 'settings/app', 'e', $_L['All_field_is_required']);
} else {
@ -223,6 +233,18 @@ switch ($action) {
$d->value = $phone;
$d->save();
$d = ORM::for_table('tbl_appconfig')->where('setting', 'CompanyFooter')->find_one();
if($d){
$d->value = $footer;
$d->save();
}else{
$d = ORM::for_table('tbl_appconfig')->create();
$d->setting = 'CompanyFooter';
$d->value = $footer;
$d->save();
}
$d = ORM::for_table('tbl_appconfig')->where('setting', 'telegram_bot')->find_one();
if($d){
$d->value = $telegram_bot;
@ -267,6 +289,38 @@ switch ($action) {
$d->save();
}
$d = ORM::for_table('tbl_appconfig')->where('setting', 'user_notification_expired')->find_one();
if($d){
$d->value = $user_notification_expired;
$d->save();
}else{
$d = ORM::for_table('tbl_appconfig')->create();
$d->setting = 'user_notification_expired';
$d->value = $user_notification_expired;
$d->save();
}
$d = ORM::for_table('tbl_appconfig')->where('setting', 'user_notification_expired_text')->find_one();
if($d){
$d->value = $user_notification_expired_text;
$d->save();
}else{
$d = ORM::for_table('tbl_appconfig')->create();
$d->setting = 'user_notification_expired_text';
$d->value = $user_notification_expired_text;
$d->save();
}
$d = ORM::for_table('tbl_appconfig')->where('setting', 'user_notification_payment')->find_one();
if($d){
$d->value = $user_notification_payment;
$d->save();
}else{
$d = ORM::for_table('tbl_appconfig')->create();
$d->setting = 'user_notification_payment';
$d->value = $user_notification_payment;
$d->save();
}
$d = ORM::for_table('tbl_appconfig')->where('setting', 'tawkto')->find_one();
if($d){
@ -305,6 +359,7 @@ switch ($action) {
$tzone = _post('tzone');
$date_format = _post('date_format');
$lan = _post('lan');
run_hook('save_localisation'); #HOOK
if ($tzone == '' or $date_format == '' or $lan == '') {
r2(U . 'settings/app', 'e', $_L['All_field_is_required']);
} else {
@ -348,7 +403,7 @@ switch ($action) {
if ($admin['user_type'] != 'Admin' and $admin['user_type'] != 'Sales') {
r2(U . "dashboard", 'e', $_L['Do_Not_Access']);
}
run_hook('view_change_password'); #HOOK
$ui->display('change-password.tpl');
break;
@ -356,6 +411,7 @@ switch ($action) {
$password = _post('password');
if ($password != '') {
$d = ORM::for_table('tbl_users')->where('username', $admin['username'])->find_one();
run_hook('change_password'); #HOOK
if ($d) {
$d_pass = $d['password'];
if (Password::_verify($password, $d_pass) == true) {
@ -409,6 +465,7 @@ switch ($action) {
$ui->assign('tables', $tables);
$ui->assign('dbsize', $mbytes);
run_hook('view_database'); #HOOK
$ui->display('dbstatus.tpl');
}
break;
@ -419,6 +476,7 @@ switch ($action) {
}
try {
run_hook('backup_database'); #HOOK
$mysqli = new mysqli($db_host, $db_user, $db_password, $db_name);
if ($mysqli->connect_errno) {
throw new Exception("Failed to connect to MySQL: " . $mysqli->connect_error);
@ -506,7 +564,7 @@ switch ($action) {
if ($admin['user_type'] != 'Admin') {
r2(U . "dashboard", 'e', $_L['Do_Not_Access']);
}
run_hook('view_add_language'); #HOOK
$ui->display('language-add.tpl');
break;
@ -523,6 +581,7 @@ switch ($action) {
if ($d) {
$msg .= $_L['Lang_already_exist'] . '<br>';
}
run_hook('save_language'); #HOOK
if ($msg == '') {
$b = ORM::for_table('tbl_language')->create();
$b->name = $name;

View File

@ -1,11 +1,11 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
**/
_auth();
$ui->assign('_title', $_L['Voucher'] . '- ' . $config['CompanyName']);
$ui->assign('_title', $_L['Voucher']);
$ui->assign('_system_menu', 'voucher');
$action = $routes['1'];
@ -19,12 +19,12 @@ require_once 'system/autoload/PEAR2/Autoload.php';
switch ($action) {
case 'activation':
run_hook('view_activate_voucher'); #HOOK
$ui->display('user-activation.tpl');
break;
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']);
@ -35,95 +35,28 @@ switch ($action) {
$date_only = date("Y-m-d");
$time = date("H:i:s");
$mikrotik = Router::_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')));
$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')));
} 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 ($v1['type'] == 'Hotspot') {
if ($b) {
if(!$_c['radius_mode']){
try {
$iport = explode(":", $mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>".$e->getMessage());
}
$printRequest = new RouterOS\Request('/ip/hotspot/user/print');
$printRequest->setArgument('.proplist', '.id');
$printRequest->setQuery(RouterOS\Query::where('name', $c['username']));
$id = $client->sendSync($printRequest)->getProperty('.id');
$setRequest = new RouterOS\Request('/ip/hotspot/user/remove');
$setRequest->setArgument('numbers', $id);
$client->sendSync($setRequest);
/* iBNuX Added:
* Time limit to Mikrotik
* 'Time_Limit', 'Data_Limit', 'Both_Limit'
*/
$addRequest = new RouterOS\Request('/ip/hotspot/user/add');
if ($p['typebp'] == "Limited") {
if ($p['limit_type'] == "Time_Limit") {
if ($p['time_unit'] == 'Hrs')
$timelimit = $p['time_limit'] . ":00:00";
else
$timelimit = "00:" . $p['time_limit'] . ":00";
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-uptime', $timelimit)
);
} else if ($p['limit_type'] == "Data_Limit") {
if ($p['data_unit'] == 'GB')
$datalimit = $p['data_limit'] . "000000000";
else
$datalimit = $p['data_limit'] . "000000";
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-bytes-total', $datalimit)
);
} else if ($p['limit_type'] == "Both_Limit") {
if ($p['time_unit'] == 'Hrs')
$timelimit = $p['time_limit'] . ":00:00";
else
$timelimit = "00:" . $p['time_limit'] . ":00";
if ($p['data_unit'] == 'GB')
$datalimit = $p['data_limit'] . "000000000";
else
$datalimit = $p['data_limit'] . "000000";
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-uptime', $timelimit)
->setArgument('limit-bytes-total', $datalimit)
);
}
} else {
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
);
}
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'];
@ -152,69 +85,9 @@ switch ($action) {
$t->type = "Hotspot";
$t->save();
} else {
if(!$_c['radius_mode']){
try {
$iport = explode(":", $mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>".$e->getMessage());
}
/* iBNuX Added:
* Time limit to Mikrotik
* 'Time_Limit', 'Data_Limit', 'Both_Limit'
*/
$addRequest = new RouterOS\Request('/ip/hotspot/user/add');
if ($p['typebp'] == "Limited") {
if ($p['limit_type'] == "Time_Limit") {
if ($p['time_unit'] == 'Hrs')
$timelimit = $p['time_limit'] . ":00:00";
else
$timelimit = "00:" . $p['time_limit'] . ":00";
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-uptime', $timelimit)
);
} else if ($p['limit_type'] == "Data_Limit") {
if ($p['data_unit'] == 'GB')
$datalimit = $p['data_limit'] . "000000000";
else
$datalimit = $p['data_limit'] . "000000";
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-bytes-total', $datalimit)
);
} else if ($p['limit_type'] == "Both_Limit") {
if ($p['time_unit'] == 'Hrs')
$timelimit = $p['time_limit'] . ":00:00";
else
$timelimit = "00:" . $p['time_limit'] . ":00";
if ($p['data_unit'] == 'GB')
$datalimit = $p['data_limit'] . "000000000";
else
$datalimit = $p['data_limit'] . "000000";
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-uptime', $timelimit)
->setArgument('limit-bytes-total', $datalimit)
);
}
} else {
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
);
}
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();
@ -250,36 +123,16 @@ switch ($action) {
$v1->user = $c['username'];
$v1->save();
// Telegram to Admin
sendTelegram( '#u'.$c['username']." Activate #Voucher #Hotspot\n".$p['name_plan'].
"\nCode: ".$code.
"\nRouter: ".$v1['routers'].
"\nPrice: ".$p['price']);
Message::sendTelegram('#u' . $c['username'] . " Activate #Voucher #Hotspot\n" . $p['name_plan'] .
"\nCode: " . $code .
"\nRouter: " . $v1['routers'] .
"\nPrice: " . $p['price']);
} else {
if ($b) {
if(!$_c['radius_mode']){
try {
$iport = explode(":", $mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>".$e->getMessage());
}
$printRequest = new RouterOS\Request('/ppp/secret/print');
$printRequest->setArgument('.proplist', '.id');
$printRequest->setQuery(RouterOS\Query::where('name', $c['username']));
$id = $client->sendSync($printRequest)->getProperty('.id');
$setRequest = new RouterOS\Request('/ppp/secret/remove');
$setRequest->setArgument('numbers', $id);
$client->sendSync($setRequest);
$addRequest = new RouterOS\Request('/ppp/secret/add');
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('service', 'pppoe')
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
);
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'];
@ -309,21 +162,9 @@ switch ($action) {
$t->type = "PPPOE";
$t->save();
} else {
if(!$_c['radius_mode']){
try {
$iport = explode(":", $mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>".$e->getMessage());
}
$addRequest = new RouterOS\Request('/ppp/secret/add');
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('service', 'pppoe')
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
);
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();
@ -359,10 +200,10 @@ switch ($action) {
$v1->user = $c['username'];
$v1->save();
// Telegram to Admin
sendTelegram( '#u'.$c['username']." Activate #Voucher #PPPOE\n".$p['name_plan'].
"\nCode: ".$code.
"\nRouter: ".$v1['routers'].
"\nPrice: ".$p['price']);
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']);
@ -372,11 +213,13 @@ switch ($action) {
break;
case 'list-activated':
$ui->assign('_system_menu', 'list-activated');
$paginator = Paginator::bootstrap('tbl_transactions', 'username', $user['username']);
$d = ORM::for_table('tbl_transactions')->where('username', $user['username'])->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_desc('id')->find_many();
$ui->assign('d', $d);
$ui->assign('paginator', $paginator);
run_hook('customer_view_activation_list'); #HOOK
$ui->display('user-activation-list.tpl');
break;

View File

@ -1,12 +1,12 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
**/
require('config.php');
/**
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
**/
require('../config.php');
require('orm.php');
use PEAR2\Net\RouterOS;
require_once 'autoload/PEAR2/Autoload.php';
ORM::configure("mysql:host=$db_host;dbname=$db_name");
@ -15,97 +15,92 @@ ORM::configure('password', $db_password);
ORM::configure('return_result_sets', true);
ORM::configure('logging', true);
include "autoload/Hookers.php";
//register all plugin
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');
$result = ORM::for_table('tbl_appconfig')->find_many();
foreach($result as $value){
$config[$value['setting']]=$value['value'];
foreach ($result as $value) {
$config[$value['setting']] = $value['value'];
}
date_default_timezone_set($config['timezone']);
$d = ORM::for_table('tbl_user_recharges')->where('status','on')->find_many();
$textExpired = $config['user_notification_expired_text'];
foreach ($d as $ds){
if($ds['type'] == 'Hotspot'){
$date_now = strtotime(date("Y-m-d H:i:s"));
$expiration = strtotime($ds['expiration'].' '.$ds['time']);
echo $ds['expiration']." : ".$ds['username'];
if ($date_now >= $expiration){
echo " : EXPIRED \r\n";
$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();
$d = ORM::for_table('tbl_user_recharges')->where('status', 'on')->find_many();
if(!$_c['radius_mode']){
try {
$iport = explode(":",$m['ip_address']);
$client = new RouterOS\Client($iport[0], $m['username'], $m['password'],($iport[1])?$iport[1]:null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>".$e->getMessage());
}
run_hook('cronjob'); #HOOK
$printRequest = new RouterOS\Request('/ip/hotspot/user/print');
$printRequest->setArgument('.proplist', '.id');
$printRequest->setQuery(RouterOS\Query::where('name', $c['username']));
$id = $client->sendSync($printRequest)->getProperty('.id');
foreach ($d as $ds) {
if ($ds['type'] == 'Hotspot') {
$date_now = strtotime(date("Y-m-d H:i:s"));
$expiration = strtotime($ds['expiration'] . ' ' . $ds['time']);
echo $ds['expiration'] . " : " . $ds['username'];
if ($date_now >= $expiration) {
echo " : EXPIRED \r\n";
$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();
$setRequest = new RouterOS\Request('/ip/hotspot/user/set');
$setRequest->setArgument('numbers', $id);
$setRequest->setArgument('limit-uptime', '00:00:05');
$client->sendSync($setRequest);
if (!$_c['radius_mode']) {
$client = Mikrotik::getClient($m['ip_address'], $m['username'], $m['password']);
Mikrotik::setHotspotLimitUptime($client, $c['username']);
Mikrotik::removeHotspotActiveUser($client, $c['username']);
Message::sendExpiredNotification($c['phonenumber'], $c['fullname'], $u['namebp'], $textExpired, $config['user_notification_expired']);
}
//update database user dengan status off
$u->status = 'off';
$u->save();
} else echo " : ACTIVE \r\n";
} else {
$date_now = strtotime(date("Y-m-d H:i:s"));
$expiration = strtotime($ds['expiration'] . ' ' . $ds['time']);
echo $ds['expiration'] . " : " . $ds['username'];
if ($date_now >= $expiration) {
echo " : EXPIRED \r\n";
$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();
//remove hotspot active
$onlineRequest = new RouterOS\Request('/ip/hotspot/active/print');
$onlineRequest->setArgument('.proplist', '.id');
$onlineRequest->setQuery(RouterOS\Query::where('user', $c['username']));
$id = $client->sendSync($onlineRequest)->getProperty('.id');
$removeRequest = new RouterOS\Request('/ip/hotspot/active/remove');
$removeRequest->setArgument('numbers', $id);
$client->sendSync($removeRequest);
if (!$_c['radius_mode']) {
$client = Mikrotik::getClient($m['ip_address'], $m['username'], $m['password']);
Mikrotik::disablePpoeUser($client, $c['username']);
Mikrotik::removePpoeActive($client, $c['username']);
Message::sendExpiredNotification($c['phonenumber'], $c['fullname'], $u['namebp'], $textExpired, $config['user_notification_expired']);
}
//update database user dengan status off
$u->status = 'off';
$u->save();
}else echo " : ACTIVE \r\n";
}else{
$date_now = strtotime(date("Y-m-d H:i:s"));
$expiration = strtotime($ds['expiration'].' '.$ds['time']);
echo $ds['expiration']." : ".$ds['username'];
if ($date_now >= $expiration){
echo " : EXPIRED \r\n";
$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();
if(!$_c['radius_mode']){
try {
$iport = explode(":",$m['ip_address']);
$client = new RouterOS\Client($iport[0], $m['username'], $m['password'],($iport[1])?$iport[1]:null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>".$e->getMessage());
}
$printRequest = new RouterOS\Request('/ppp/secret/print');
$printRequest->setArgument('.proplist', '.id');
$printRequest->setQuery(RouterOS\Query::where('name', $c['username']));
$id = $client->sendSync($printRequest)->getProperty('.id');
$setRequest = new RouterOS\Request('/ppp/secret/disable');
$setRequest->setArgument('numbers', $id);
$client->sendSync($setRequest);
//remove hotspot active
$onlineRequest = new RouterOS\Request('/ppp/active/print');
$onlineRequest->setArgument('.proplist', '.id');
$onlineRequest->setQuery(RouterOS\Query::where('name', $c['username']));
$id = $client->sendSync($onlineRequest)->getProperty('.id');
$removeRequest = new RouterOS\Request('/ppp/active/remove');
$removeRequest->setArgument('numbers', $id);
$client->sendSync($removeRequest);
}
$u->status = 'off';
$u->save();
}else echo " : ACTIVE \r\n";
}
$u->status = 'off';
$u->save();
} else echo " : ACTIVE \r\n";
}
}

View File

@ -3,7 +3,7 @@
-----------------------------------
Language Name: English
Contributor: Ismail Marzuqi
Web: www.phpmixbill.com
Web: www.phpnuxbill.com
Email: iesien22@yahoo.com
2017
@ -21,7 +21,7 @@ $_L['Register_Success'] = 'Register Success! You can login now';
$_L['Sign_In_Member'] = 'Log in to Member Panel';
$_L['Register_Member'] = 'Register as Member';
$_L['Sign_In_Admin'] = 'Masuk ke Admin Panel';
$_L['Logo'] = 'PHPMixBill';
$_L['Logo'] = 'PHPNuxBill';
$_L['Username'] = 'Username';
$_L['Password'] = 'Password';
$_L['PasswordsNotMatch'] = 'Passwords does not match';
@ -217,7 +217,7 @@ $_L['Title'] = 'Title';
$_L['Message'] = 'Message';
$_L['Account_Information'] = 'Your Account Information';
$_L['Welcome_Text_User'] = 'Welcome to the Panel Members page, on this page you can:';
$_L['Welcome_Text_Admin'] = '<b>PHPMixBill</b> is a billing Hotspot and PPPOE for Mikrotik using PHP and Mikrotik API to comunicate with router. If you get more profit with this application, please donate us.<br>Watch project <a href="https://github.com/ibnux/phpmixbill" target="_blank">in here</a>';
$_L['Welcome_Text_Admin'] = '<b>PHPNuxBill</b> is a billing Hotspot and PPPOE for Mikrotik using PHP and Mikrotik API to comunicate with router. If you get more profit with this application, please donate us.<br>Watch project <a href="https://github.com/hotspotbilling/phpnuxbill" target="_blank">in here</a>';
//update
$_L['Invalid_Username_or_Password'] = 'Invalid Username or Password';

View File

@ -3,7 +3,7 @@
-----------------------------------
Language Name: Indonesia
Contributor: Ismail Marzuqi
Web: www.phpmixbill.com
Web: www.phpnuxbill.com
Email: iesien22@yahoo.com
2017
@ -21,7 +21,7 @@ $_L['Register_Success'] = 'Pendaftaran sukses!<br>silahkan masuk';
$_L['Sign_In_Member'] = 'Masuk ke Member Panel';
$_L['Register_Member'] = 'Mendaftar sebagai pelanggan<br>pastikan anda sudah membeli voucher';
$_L['Sign_In_Admin'] = 'Masuk ke Admin Panel';
$_L['Logo'] = 'PHPMixBill';
$_L['Logo'] = 'PHPNuxBill';
$_L['Username'] = 'Username';
$_L['Password'] = 'Password';
$_L['PasswordsNotMatch'] = 'Sandi tidak sama';
@ -216,7 +216,7 @@ $_L['Title'] = 'Title';
$_L['Message'] = 'Message';
$_L['Account_Information'] = 'Informasi Akun Anda';
$_L['Welcome_Text_User'] = 'Selamat datang di Member Panel, disini Anda dapat mengetahui:';
$_L['Welcome_Text_Admin'] = '<b>PHPMixBill</b> adalah sebuah aplikasi billing Hotspot dan PPPOE untuk Mikrotik dengan menggunakan bahasa pemograman PHP dan menggunakan API Mikrotik sebagai komunikasi dengan router. Jika aplikasi ini sangat berguna bagi bisnis Anda silahkan Anda donasi berapapun.<br>Pantau proyek <a href="https://github.com/ibnux/phpmixbill" target="_blank">disini</a>';
$_L['Welcome_Text_Admin'] = '<b>PHPNuxBill</b> adalah sebuah aplikasi billing Hotspot dan PPPOE untuk Mikrotik dengan menggunakan bahasa pemograman PHP dan menggunakan API Mikrotik sebagai komunikasi dengan router. Jika aplikasi ini sangat berguna bagi bisnis Anda silahkan Anda donasi berapapun.<br>Pantau proyek <a href="https://github.com/hotspotbilling/phpnuxbill" target="_blank">disini</a>';
//update
$_L['Invalid_Username_or_Password'] = 'Username atau Password Salah';
@ -291,5 +291,28 @@ $_L['Order_History'] = 'Order History';
$_L['Gateway'] = 'Gateway';
$_L['Date_Done'] = 'Date Done';
$_L['Unpaid_Order'] = 'Unpaid Order';
$_L['Payment_Gateway_Not_Found'] = 'Payment Gateway Not Found';
$_L['Payment_Gateway_saved_successfully'] = 'Payment Gateway saved successfully';
$_L['Payment_Gateway_Not_Found'] = 'Payment Gateway Not Found';
$_L['Payment_Gateway_saved_successfully'] = 'Payment Gateway saved successfully';
$_L['ORDER'] = 'ORDER';
$_L['Package_History'] = 'Package History';
$_L['Buy_History'] = 'Buy History';
$_L['Activation_History'] = 'Activation History';
$_L['Buy_Package'] = 'Buy Package';
$_L['Email'] = 'Email';
$_L['Company_Footer'] = 'Company Footer';
$_L['Will_show_below_user_pages'] = 'Will show below user pages';
$_L['Request_OTP'] = 'Request OTP';
$_L['Verification_Code'] = 'Verification Code';
$_L['SMS_Verification_Code'] = 'SMS Verification Code';
$_L['Please_enter_your_email_address'] = 'Please enter your email address';
$_L['Failed_to_create_Paypal_transaction'] = 'Failed to create Paypal transaction.';
$_L['Plugin'] = 'Plugin';
$_L['Plugin_Manager'] = 'Plugin Manager';
$_L['Plugin_Manager'] = 'Plugin Manager';
$_L['User_Notification'] = 'User Notification';
$_L['Expired_Notification'] = 'Expired Notification';
$_L['User_will_get_notification_when_package_expired'] = 'User will get notification when package expired';
$_L['Expired_Notification_Message'] = 'Expired Notification Message';
$_L['bnameb_will_be_replaced_with_Customer_Name_bpackageb_will_be_replaced_with_Package_name'] = '<b>[[name]]</b> will be replaced with Customer Name. <b>[[package]]</b> will be replaced with Package name.';
$_L['Payment_Notification'] = 'Payment Notification';
$_L['User_will_get_invoice_notification_when_buy_package_or_package_refilled'] = 'User will get invoice notification when buy package or package refilled';

View File

@ -3,7 +3,7 @@
-----------------------------------
Language Name: Spanish
Contributor: Ing.Luis E. Hernandez
Web: www.phpmixbill.com
Web: www.phpnuxbill.com
Email: contacto.webland@gmail.com
2022
@ -217,7 +217,7 @@ $_L['Title'] = 'Título';
$_L['Message'] = 'Mensaje';
$_L['Account_Information'] = 'Información de su cuenta';
$_L['Welcome_Text_User'] = 'Bienvenido a la página de Miembros del Panel, en esta página puede:';
$_L['Welcome_Text_Admin'] = '<b>MIKRO-RED</b> es un punto de acceso de facturación y PPPOE para Mikrotik que utiliza PHP y la API de Mikrotik para comunicarse con el enrutador. Si obtiene más ganancias con esta aplicación, por favor dónenos.<br>Ver proyecto <a href="https://github.com/ibnux/phpmixbill" target="_blank">aqui</a>';
$_L['Welcome_Text_Admin'] = '<b>MIKRO-RED</b> es un punto de acceso de facturación y PPPOE para Mikrotik que utiliza PHP y la API de Mikrotik para comunicarse con el enrutador. Si obtiene más ganancias con esta aplicación, por favor dónenos.<br>Ver proyecto <a href="https://github.com/hotspotbilling/phpnuxbill" target="_blank">aqui</a>';
//update
$_L['Invalid_Username_or_Password'] = 'Usuario o contraseña invalido';

View File

@ -16,7 +16,7 @@ $_L['Register_Success'] = 'Kayıt Başarılı! Şimdi giriş yapabilirsiniz ';
$_L['Sign_In_Member'] = 'Üye Paneli\'ne giriş yapın';
$_L['Register_Member'] = 'Üye olarak kayıt ol';
$_L['Sign_In_Admin'] = 'Yönetici Paneli Girişi';
$_L['Logo'] = 'PHPMixBill';
$_L['Logo'] = 'PHPNuxBill';
$_L['Username'] = 'Kullanıcı adı';
$_L['Password'] = 'Parola';
$_L['PasswordsNotMatch'] = 'Parolalar eşleşmiyor';
@ -196,7 +196,7 @@ $_L['Title'] = 'Başlık';
$_L['Message'] = 'Mesaj';
$_L['Account_Information'] = 'Hesap Bilgileriniz';
$_L['Welcome_Text_User'] = 'Panel Üyeleri sayfasına hoş geldiniz, bu sayfada şunları yapabilirsiniz:';
$_L['Welcome_Text_Admin'] = '<b> PHPMixBill </ b>, PHP ve Mikrotik API kullanılarak Mikrotik için bir faturalandırma Hotspot ve PPPOE olup, yönlendiriciyle iletişim kurar. Bu uygulamayla daha fazla kazanç elde ederseniz, lütfen bize bağış yapın. <br> Projeyi <a href="https://github.com/ibnux/phpmixbill" target="_blank"> buradan izleyin </a> ';
$_L['Welcome_Text_Admin'] = '<b> PHPNuxBill </ b>, PHP ve Mikrotik API kullanılarak Mikrotik için bir faturalandırma Hotspot ve PPPOE olup, yönlendiriciyle iletişim kurar. Bu uygulamayla daha fazla kazanç elde ederseniz, lütfen bize bağış yapın. <br> Projeyi <a href="https://github.com/hotspotbilling/phpnuxbill" target="_blank"> buradan izleyin </a> ';
$_L['Invalid_Username_or_Password'] = 'Geçersiz kullanıcı adı veya şifre';
$_L['Do_Not_Access'] = 'Bu sayfaya erişim izniniz yok';
$_L['Incorrect_Current_Password'] = 'Yanlış Geçerli Şifre';

View File

@ -1,90 +0,0 @@
[
{
"id": "BC",
"name": "BCA"
},
{
"id": "M2",
"name": "Mandiri"
},
{
"id": "VA",
"name": "Maybank"
},
{
"id": "I1",
"name": "BNI"
},
{
"id": "B1",
"name": "CIMB Niaga"
},
{
"id": "BT",
"name": "Permata Bank"
},
{
"id": "A1",
"name": "ATM Bersama"
},
{
"id": "AG",
"name": "Artha Graha"
},
{
"id": "BR",
"name": "BRIVA"
},
{
"id": "S1",
"name": "Bank Sahabat Sampoerna"
},
{
"id": "OV",
"name": "OVO"
},
{
"id": "SA",
"name": "Shopee Pay"
},
{
"id": "LF",
"name": "LinkAja Apps (Fixed Fee)"
},
{
"id": "LA",
"name": "LinkAja Apps (Percentage Fee)"
},
{
"id": "DA",
"name": "DANA"
},
{
"id": "SP",
"name": "QRIS Shopee Pay"
},
{
"id": "LQ",
"name": "QRIS LinkAja"
},
{
"id": "NQ",
"name": "QRIS Nobu"
},
{
"id": "FT",
"name": "Pegadaian/ALFA/Pos"
},
{
"id": "A2",
"name": "POS Indonesia"
},
{
"id": "IR",
"name": "Indomaret"
},
{
"id": "VC",
"name": "Credit Card (Visa / Master Card / JCB)"
}
]

View File

@ -1,66 +0,0 @@
[
{
"id": "credit_card",
"name": "Credit Card"
},
{
"id": "bca_va",
"name": "BCA"
},
{
"id": "permata_va",
"name": "Permata"
},
{
"id": "bni_va",
"name": "BNI"
},
{
"id": "bri_va",
"name": "BRI"
},
{
"id": "echannel",
"name": "Mandiri Bill"
},
{
"id": "gopay",
"name": "Gopay"
},
{
"id": "bca_klikbca",
"name": "KLIKBCA"
},
{
"id": "bca_klikpay",
"name": "BCA KLIKPAY"
},
{
"id": "cimb_clicks",
"name": "CIMB Clicks"
},
{
"id": "danamon_online",
"name": "Danamon"
},
{
"id": "bri_epay",
"name": "BRImo"
},
{
"id": "indomaret",
"name": "Indomaret"
},
{
"id": "alfamart",
"name": "Alfamart"
},
{
"id": "ShopeePay",
"name": "ShopeePay"
},
{
"id": "uob_ezpay",
"name": "UOB EZ Pay"
}
]

View File

@ -1,74 +0,0 @@
[
{
"id": "PERMATAVA",
"name": "Permata Bank"
},
{
"id": "MYBVA",
"name": "Maybank"
},
{
"id": "BNIVA",
"name": "BNI"
},
{
"id": "BRIVA",
"name": "BRI"
},
{
"id": "MANDIRIVA",
"name": "Mandiri"
},
{
"id": "BCAVA",
"name": "BCA"
},
{
"id": "SMSVA",
"name": "Sinarmas"
},
{
"id": "MUAMALATVA",
"name": "Muamalat"
},
{
"id": "SAMPOERNAVA",
"name": "Sahabat Sampoerna"
},
{
"id": "BSIVA",
"name": "BSI"
},
{
"id": "ALFAMART",
"name": "Alfamart "
},
{
"id": "INDOMARET",
"name": "Indomaret "
},
{
"id": "ALFAMIDI",
"name": "Alfamidi "
},
{
"id": "OVO",
"name": "OVO"
},
{
"id": "QRIS",
"name": "QRIS by ShopeePay"
},
{
"id": "QRISC",
"name": "QRIS (Customizable)"
},
{
"id": "QRIS2",
"name": "QRIS"
},
{
"id": "SHOPEEPAY",
"name": "ShopeePay "
}
]

View File

@ -1,66 +0,0 @@
[
{
"id": "CREDIT_CARD",
"name": "CREDIT CARD"
},
{
"id": "PERMATA",
"name": "Permata Bank"
},
{
"id": "BNI",
"name": "BNI"
},
{
"id": "BRI",
"name": "BRI"
},
{
"id": "MANDIRI",
"name": "Mandiri"
},
{
"id": "BCA",
"name": "BCA"
},
{
"id": "BSI",
"name": "BSI"
},
{
"id": "DD_BRI",
"name": "Direct Debit BRI"
},
{
"id": "DD_BCA_KLIKPAY",
"name": "Direct Debit BCA KLIKPAY"
},
{
"id": "ALFAMART",
"name": "Alfamart "
},
{
"id": "INDOMARET",
"name": "Indomaret "
},
{
"id": "OVO",
"name": "OVO"
},
{
"id": "DANA",
"name": "DANA"
},
{
"id": "LINKAJA",
"name": "LinkAja"
},
{
"id": "SHOPEEPAY",
"name": "ShopeePay "
},
{
"id": "QRIS",
"name": "QRIS"
}
]

View File

@ -1,170 +0,0 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
*
* Payment Gateway duitku.com
**/
function duitku_validate_config()
{
global $config;
if (empty($config['duitku_merchant_key'])) {
sendTelegram("Duitku payment gateway not configured");
r2(U . 'order/package', 'w', Lang::T("Admin has not yet setup Duitku payment gateway, please tell admin"));
}
}
function duitku_show_config()
{
global $ui, $config;
$ui->assign('_title', 'Duitku - Payment Gateway - ' . $config['CompanyName']);
$ui->assign('channels', json_decode(file_get_contents('system/paymentgateway/channel_duitku.json'), true));
$ui->display('pg-duitku.tpl');
}
function duitku_save_config()
{
global $admin;
$duitku_merchant_id = _post('duitku_merchant_id');
$duitku_merchant_key = _post('duitku_merchant_key');
$d = ORM::for_table('tbl_appconfig')->where('setting', 'duitku_merchant_id')->find_one();
if ($d) {
$d->value = $duitku_merchant_id;
$d->save();
} else {
$d = ORM::for_table('tbl_appconfig')->create();
$d->setting = 'duitku_merchant_id';
$d->value = $duitku_merchant_id;
$d->save();
}
$d = ORM::for_table('tbl_appconfig')->where('setting', 'duitku_merchant_key')->find_one();
if ($d) {
$d->value = $duitku_merchant_key;
$d->save();
} else {
$d = ORM::for_table('tbl_appconfig')->create();
$d->setting = 'duitku_merchant_key';
$d->value = $duitku_merchant_key;
$d->save();
}
$d = ORM::for_table('tbl_appconfig')->where('setting', 'duitku_channel')->find_one();
if ($d) {
$d->value = implode(',', $_POST['duitku_channel']);
$d->save();
} else {
$d = ORM::for_table('tbl_appconfig')->create();
$d->setting = 'duitku_channel';
$d->value = implode(',', $_POST['duitku_channel']);
$d->save();
}
_log('[' . $admin['username'] . ']: Duitku ' . Lang::T('Settings_Saved_Successfully'), 'Admin', $admin['id']);
r2(U . 'paymentgateway/duitku', 's', Lang::T('Settings_Saved_Successfully'));
}
function duitku_create_transaction($trx, $user)
{
global $config, $routes, $ui;
$channels = json_decode(file_get_contents('system/paymentgateway/channel_duitku.json'), true);
if (!in_array($routes[4], explode(",", $config['duitku_channel']))) {
$ui->assign('_title', 'Duitku Channel - ' . $config['CompanyName']);
$ui->assign('channels', $channels);
$ui->assign('duitku_channels', explode(",", $config['duitku_channel']));
$ui->assign('path', $routes['2'] . '/' . $routes['3']);
$ui->display('duitku_channel.tpl');
die();
}
$json = [
'paymentMethod' => $routes[4],
'paymentAmount' => $trx['price'],
'merchantCode' => $config['duitku_merchant_id'],
'merchantOrderId' => $trx['id'],
'productDetails' => $trx['plan_name'],
'merchantUserInfo' => $user['fullname'],
'customerVaName' => $user['fullname'],
'email' => (empty($user['email'])) ? $user['username'] . '@' . $_SERVER['HTTP_HOST'] : $user['email'],
'phoneNumber' => $user['phonenumber'],
'itemDetails' => [
[
'name' => $trx['plan_name'],
'price' => $trx['price'],
'quantity' => 1
]
],
'returnUrl' => U . 'order/view/' . $trx['id'] . '/check',
'signature' => md5($config['duitku_merchant_id'] . $trx['id'] . $trx['price'] . $config['duitku_merchant_key'])
];
$result = json_decode(Http::postJsonData(duitku_get_server() . 'v2/inquiry', $json), true);
if (empty($result['paymentUrl'])) {
sendTelegram("Duitku payment failed\n\n" . json_encode($result, JSON_PRETTY_PRINT));
r2(U . 'order/package', 'e', Lang::T("Failed to create transaction."));
}
$d = ORM::for_table('tbl_payment_gateway')
->where('username', $user['username'])
->where('status', 1)
->find_one();
$d->gateway_trx_id = $result['reference'];
$d->pg_url_payment = $result['paymentUrl'];
$d->payment_method = $routes['4'];
foreach ($channels as $channel) {
if ($channel['id'] == $routes['4']) {
$d->payment_channel = $channel['name'];
break;
}
}
$d->pg_request = json_encode($result);
$d->expired_date = date('Y-m-d H:i:s', strtotime("+1 day"));
$d->save();
r2(U . "order/view/" . $d['id'], 's', Lang::T("Create Transaction Success"));
}
function duitku_get_status($trx, $user)
{
global $config;
$json = [
'merchantCode' => $config['duitku_merchant_id'],
'merchantOrderId' => $trx['id'],
'signature' => md5($config['duitku_merchant_id'] . $trx['id'] . $config['duitku_merchant_key'])
];
$result = json_decode(Http::postJsonData(duitku_get_server() . 'transactionStatus', $json), true);
if ($result['reference'] != $trx['gateway_trx_id']) {
sendTelegram("Duitku payment status failed\n\n" . json_encode($result, JSON_PRETTY_PRINT));
r2(U . "order/view/" . $trx['id'], 'w', Lang::T("Payment check failed."));
}
if ($result['statusCode'] == '01') {
r2(U . "order/view/" . $trx['id'], 'w', Lang::T("Transaction still unpaid."));
} else if ($result['statusCode'] == '00' && $trx['status'] != 2) {
if (!Package::rechargeUser($user['id'], $trx['routers'], $trx['plan_id'], $trx['gateway'], $trx['payment_channel'])) {
r2(U . "order/view/" . $trx['id'], 'd', Lang::T("Failed to activate your Package, try again later."));
}
$trx->pg_paid_response = json_encode($result);
$trx->paid_date = date('Y-m-d H:i:s');
$trx->status = 2;
$trx->save();
r2(U . "order/view/" . $trx['id'], 's', Lang::T("Transaction has been paid."));
} else if ($result['statusCode'] == '02') {
$trx->pg_paid_response = json_encode($result);
$trx->status = 3;
$trx->save();
r2(U . "order/view/" . $trx['id'], 'd', Lang::T("Transaction expired or Failed."));
} else if ($trx['status'] == 2) {
r2(U . "order/view/" . $trx['id'], 'd', Lang::T("Transaction has been paid.."));
}
}
function duitku_get_server()
{
global $_app_stage;
if ($_app_stage == 'Live') {
return 'https://passport.duitku.com/webapi/api/merchant/';
} else {
return 'https://sandbox.duitku.com/webapi/api/merchant/';
}
}

View File

View File

@ -1,172 +0,0 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
*
* Payment Gateway tripay.com
**/
function duitku_validate_config()
{
global $config;
if (empty($config['tripay_secret_key'])) {
sendTelegram("Tripay payment gateway not configured");
r2(U . 'order/package', 'w', Lang::T("Admin has not yet setup Tripay payment gateway, please tell admin"));
}
}
function tripay_show_config()
{
global $ui, $config;
$ui->assign('_title', 'Tripay - Payment Gateway - ' . $config['CompanyName']);
$ui->assign('channels', json_decode(file_get_contents('system/paymentgateway/channel_tripay.json'), true));
$ui->display('pg-tripay.tpl');
}
function tripay_save_config()
{
global $admin, $_L;
$tripay_merchant = _post('tripay_merchant');
$tripay_api_key = _post('tripay_api_key');
$tripay_secret_key = _post('tripay_secret_key');
$d = ORM::for_table('tbl_appconfig')->where('setting', 'tripay_merchant')->find_one();
if ($d) {
$d->value = $tripay_merchant;
$d->save();
} else {
$d = ORM::for_table('tbl_appconfig')->create();
$d->setting = 'tripay_merchant';
$d->value = $tripay_merchant;
$d->save();
}
$d = ORM::for_table('tbl_appconfig')->where('setting', 'tripay_api_key')->find_one();
if ($d) {
$d->value = $tripay_api_key;
$d->save();
} else {
$d = ORM::for_table('tbl_appconfig')->create();
$d->setting = 'tripay_api_key';
$d->value = $tripay_api_key;
$d->save();
}
$d = ORM::for_table('tbl_appconfig')->where('setting', 'tripay_secret_key')->find_one();
if ($d) {
$d->value = $tripay_secret_key;
$d->save();
} else {
$d = ORM::for_table('tbl_appconfig')->create();
$d->setting = 'tripay_secret_key';
$d->value = $tripay_secret_key;
$d->save();
}
$d = ORM::for_table('tbl_appconfig')->where('setting', 'tripay_channel')->find_one();
if ($d) {
$d->value = implode(',', $_POST['tripay_channel']);
$d->save();
} else {
$d = ORM::for_table('tbl_appconfig')->create();
$d->setting = 'tripay_channel';
$d->value = implode(',', $_POST['tripay_channel']);
$d->save();
}
_log('[' . $admin['username'] . ']: Tripay ' . $_L['Settings_Saved_Successfully'] . json_encode($_POST['tripay_channel']), 'Admin', $admin['id']);
r2(U . 'paymentgateway/tripay', 's', $_L['Settings_Saved_Successfully']);
}
function tripay_create_transaction($trx, $user)
{
global $config, $routes, $ui;
$channels = json_decode(file_get_contents('system/paymentgateway/channel_tripay.json'), true);
if (!in_array($routes[4], explode(",", $config['tripay_channel']))) {
$ui->assign('_title', 'Tripay Channel - ' . $config['CompanyName']);
$ui->assign('channels', $channels);
$ui->assign('tripay_channels', explode(",", $config['tripay_channel']));
$ui->assign('path', $routes[2] . '/' . $routes[3]);
$ui->display('tripay_channel.tpl');
die();
}
$json = [
'method' => $routes[4],
'amount' => $trx['price'],
'merchant_ref' => $trx['id'],
'customer_name' => $user['fullname'],
'customer_email' => (empty($user['email'])) ? $user['username'] . '@' . $_SERVER['HTTP_HOST'] : $user['email'],
'customer_phone' => $user['phonenumber'],
'order_items' => [
[
'name' => $trx['plan_name'],
'price' => $trx['price'],
'quantity' => 1
]
],
'return_url' => U . 'order/view/' . $trx['id'] . '/check',
'signature' => hash_hmac('sha256', $config['tripay_merchant'] . $trx['id'] . $trx['price'], $config['tripay_secret_key'])
];
$result = json_decode(Http::postJsonData(tripay_get_server() . 'transaction/create', $json, ['Authorization: Bearer ' . $config['tripay_api_key']]), true);
if ($result['success'] != 1) {
sendTelegram("Tripay payment failed\n\n" . json_encode($result, JSON_PRETTY_PRINT));
r2(U . 'order/package', 'e', Lang::T("Failed to create transaction."));
}
$d = ORM::for_table('tbl_payment_gateway')
->where('username', $user['username'])
->where('status', 1)
->find_one();
$d->gateway_trx_id = $result['data']['reference'];
$d->pg_url_payment = $result['data']['checkout_url'];
$d->pg_request = json_encode($result);
$d->expired_date = date('Y-m-d H:i:s', $result['data']['expired_time']);
$d->save();
r2(U . "order/view/" . $d['id'], 's', Lang::T("Create Transaction Success"));
}
function tripay_get_status($trx, $user)
{
global $config;
$result = json_decode(Http::getData(tripay_get_server() . 'transaction/detail?' . http_build_query(['reference' => $trx['gateway_trx_id']]), [
'Authorization: Bearer ' . $config['tripay_api_key']
]), true);
if ($result['success'] != 1) {
sendTelegram("Tripay payment status failed\n\n" . json_encode($result, JSON_PRETTY_PRINT));
r2(U . "order/view/" . $trx['id'], 'w', Lang::T("Payment check failed."));
}
$result = $result['data'];
if ($result['status'] == 'UNPAID') {
r2(U . "order/view/" . $trx['id'], 'w', Lang::T("Transaction still unpaid."));
} else if (in_array($result['status'], ['PAID', 'SETTLED']) && $trx['status'] != 2) {
if (!Package::rechargeUser($user['id'], $trx['routers'], $trx['plan_id'], $trx['gateway'], $result['payment_name'])) {
r2(U . "order/view/" . $trx['id'], 'd', Lang::T("Failed to activate your Package, try again later."));
}
$trx->pg_paid_response = json_encode($result);
$trx->payment_method = $result['payment_method'];
$trx->payment_channel = $result['payment_name'];
$trx->paid_date = date('Y-m-d H:i:s', $result['paid_at']);
$trx->status = 2;
$trx->save();
r2(U . "order/view/" . $trx['id'], 's', Lang::T("Transaction has been paid."));
} else if (in_array($result['status'], ['EXPIRED', 'FAILED', 'REFUND'])) {
$trx->pg_paid_response = json_encode($result);
$trx->status = 3;
$trx->save();
r2(U . "order/view/" . $trx['id'], 'd', Lang::T("Transaction expired."));
} else if ($trx['status'] == 2) {
r2(U . "order/view/" . $trx['id'], 'd', Lang::T("Transaction has been paid.."));
}
}
function tripay_get_server()
{
global $_app_stage;
if ($_app_stage == 'Live') {
return 'https://tripay.co.id/api/';
} else {
return 'https://tripay.co.id/api-sandbox/';
}
}

View File

View File

@ -1,150 +0,0 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
*
* Payment Gateway xendit.com
**/
function xendit_validate_config()
{
global $config;
if (empty($config['xendit_secret_key']) || empty($config['xendit_verification_token'])) {
sendTelegram("Xendit payment gateway not configured");
r2(U . 'order/package', 'w', Lang::T("Admin has not yet setup Xendit payment gateway, please tell admin"));
}
}
function xendit_show_config()
{
global $ui, $config;
$ui->assign('_title', 'Xendit - Payment Gateway - ' . $config['CompanyName']);
$ui->assign('channels', json_decode(file_get_contents('system/paymentgateway/channel_xendit.json'), true));
$ui->display('pg-xendit.tpl');
}
function xendit_save_config()
{
global $admin, $_L;
$xendit_secret_key = _post('xendit_secret_key');
$xendit_verification_token = _post('xendit_verification_token');
$d = ORM::for_table('tbl_appconfig')->where('setting', 'xendit_secret_key')->find_one();
if ($d) {
$d->value = $xendit_secret_key;
$d->save();
} else {
$d = ORM::for_table('tbl_appconfig')->create();
$d->setting = 'xendit_secret_key';
$d->value = $xendit_secret_key;
$d->save();
}
$d = ORM::for_table('tbl_appconfig')->where('setting', 'xendit_verification_token')->find_one();
if ($d) {
$d->value = $xendit_verification_token;
$d->save();
} else {
$d = ORM::for_table('tbl_appconfig')->create();
$d->setting = 'xendit_verification_token';
$d->value = $xendit_verification_token;
$d->save();
}
$d = ORM::for_table('tbl_appconfig')->where('setting', 'xendit_channel')->find_one();
if ($d) {
$d->value = implode(',', $_POST['xendit_channel']);
$d->save();
} else {
$d = ORM::for_table('tbl_appconfig')->create();
$d->setting = 'xendit_channel';
$d->value = implode(',', $_POST['xendit_channel']);
$d->save();
}
_log('[' . $admin['username'] . ']: Xendit ' . $_L['Settings_Saved_Successfully'], 'Admin', $admin['id']);
r2(U . 'paymentgateway/xendit', 's', $_L['Settings_Saved_Successfully']);
}
function xendit_create_transaction($trx, $user)
{
global $config;
$json = [
'external_id' => $trx['id'],
'amount' => $trx['price'],
'description' => $trx['plan_name'],
'customer' => [
'mobile_number' => $user['phonenumber'],
],
'customer_notification_preference' => [
'invoice_created' => ['whatsapp', 'sms'],
'invoice_reminder' => ['whatsapp', 'sms'],
'invoice_paid' => ['whatsapp', 'sms'],
'invoice_expired' => ['whatsapp', 'sms']
],
'payment_methods ' => explode(',', $config['xendit_channel']),
'success_redirect_url' => U . 'order/view/' . $trx['id'] . '/check',
'failure_redirect_url' => U . 'order/view/' . $trx['id'] . '/check'
];
$result = json_decode(Http::postJsonData(xendit_get_server() . 'invoices', $json, ['Authorization: Basic ' . base64_encode($config['xendit_secret_key'] . ':')]), true);
if (!$result['id']) {
r2(U . 'order/package', 'e', Lang::T("Failed to create transaction."));
}
$d = ORM::for_table('tbl_payment_gateway')
->where('username', $user['username'])
->where('status', 1)
->find_one();
$d->gateway_trx_id = $result['id'];
$d->pg_url_payment = $result['invoice_url'];
$d->pg_request = json_encode($result);
$d->expired_date = date('Y-m-d H:i:s', strtotime($result['expiry_date']));
$d->save();
header('Location: ' . $result['invoice_url']);
exit();
}
function xendit_get_status($trx, $user)
{
global $config;
$result = json_decode(Http::getData(xendit_get_server() . 'invoices/' . $trx['gateway_trx_id'], [
'Authorization: Basic ' . base64_encode($config['xendit_secret_key'] . ':')
]), true);
if ($result['status'] == 'PENDING') {
r2(U . "order/view/" . $trx['id'], 'w', Lang::T("Transaction still unpaid."));
} else if (in_array($result['status'], ['PAID', 'SETTLED']) && $trx['status'] != 2) {
if (!Package::rechargeUser($user['id'], $trx['routers'], $trx['plan_id'], $trx['gateway'], $result['payment_channel'])) {
r2(U . "order/view/" . $trx['id'], 'd', Lang::T("Failed to activate your Package, try again later."));
}
$trx->pg_paid_response = json_encode($result);
$trx->payment_method = $result['payment_method'];
$trx->payment_channel = $result['payment_channel'];
$trx->paid_date = date('Y-m-d H:i:s', strtotime($result['updated']));
$trx->status = 2;
$trx->save();
r2(U . "order/view/" . $trx['id'], 's', Lang::T("Transaction has been paid."));
} else if ($result['status'] == 'EXPIRED') {
$trx->pg_paid_response = json_encode($result);
$trx->status = 3;
$trx->save();
r2(U . "order/view/" . $trx['id'], 'd', Lang::T("Transaction expired."));
} else if ($trx['status'] == 2) {
r2(U . "order/view/" . $trx['id'], 'd', Lang::T("Transaction has been paid.."));
}else{
sendTelegram("xendit_get_status: unknown result\n\n".json_encode($result, JSON_PRETTY_PRINT));
r2(U . "order/view/" . $trx['id'], 'd', Lang::T("Unknown Command."));
}
}
function xendit_get_server()
{
global $_app_stage;
if ($_app_stage == 'Live') {
return 'https://api.xendit.co/v2/';
} else {
return 'https://api.xendit.co/v2/';
}
}

0
system/plugin/index.html Normal file
View File

View File

View File

@ -1,13 +1,13 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
**/
if(php_sapi_name() !== 'cli'){
die("RUN ON COMMAND LINE ONLY BY RADIUS ENGINE");
}
require(__DIR__.'/config.php');
require(__DIR__.'/../config.php');
require(__DIR__.'/orm.php');
use PEAR2\Net\RouterOS;

View File

@ -2890,8 +2890,8 @@
0DCF;SINHALA VOWEL SIGN AELA-PILLA;Mc;0;L;;;;;N;;;;;
0DD0;SINHALA VOWEL SIGN KETTI AEDA-PILLA;Mc;0;L;;;;;N;;;;;
0DD1;SINHALA VOWEL SIGN DIGA AEDA-PILLA;Mc;0;L;;;;;N;;;;;
0DD2;SINHALA VOWEL SIGN KETTI IS-PILLA;Mn;0;NSM;;;;;N;;;;;
0DD3;SINHALA VOWEL SIGN DIGA IS-PILLA;Mn;0;NSM;;;;;N;;;;;
0DD2;SINHALA VOWEL SIGN KETTI table-PILLA;Mn;0;NSM;;;;;N;;;;;
0DD3;SINHALA VOWEL SIGN DIGA table-PILLA;Mn;0;NSM;;;;;N;;;;;
0DD4;SINHALA VOWEL SIGN KETTI PAA-PILLA;Mn;0;NSM;;;;;N;;;;;
0DD6;SINHALA VOWEL SIGN DIGA PAA-PILLA;Mn;0;NSM;;;;;N;;;;;
0DD8;SINHALA VOWEL SIGN GAETTA-PILLA;Mc;0;L;;;;;N;;;;;

View File

@ -3,7 +3,6 @@
<div class="page page-err clearfix">
<div class="err-container">
<h1 class="m404 mb0">404 <a href="{$_url}dashboard" class="ion ion-forward" title="go to dashboard"></a></h1>
<p class="text-desc mb20">Coming Soon!! Next Version...</p>
</div>
</div>

45
ui/ui/admin-login.tpl Normal file
View File

@ -0,0 +1,45 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>{$_title} - {$_L['Login']}</title>
<link rel="shortcut icon" href="ui/ui/images/logo.png" type="image/x-icon" />
<!-- Css/Less Stylesheets -->
<link rel="stylesheet" href="ui/ui/styles/bootstrap.min.css">
<link rel="stylesheet" href="ui/ui/styles/adminlte.min.css">
</head>
<body class="hold-transition login-page">
<div class="login-box">
<div class="login-logo">
<b>Nux</b>Billing
</div>
<div class="login-box-body">
<p class="login-box-msg">{$_L['Sign_In_Admin']}</p>
{if isset($notify)}
{$notify}
{/if}
<form action="{$_url}admin/post" method="post">
<div class="form-group has-feedback">
<input type="text" required class="form-control" name="username" placeholder="{$_L['Username']}">
<span class="glyphicon glyphicon-user form-control-feedback"></span>
</div>
<div class="form-group has-feedback">
<input type="password" required class="form-control" name="password" placeholder="{$_L['Password']}">
<span class="glyphicon glyphicon-lock form-control-feedback"></span>
</div>
<button type="submit" class="btn btn-primary btn-block btn-flat">{$_L['Login']}</button>
</form>
</div>
</div>
<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>
</body>
</html>

View File

@ -1,71 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>{$_title} - {$_L['Login']}</title>
<link rel="shortcut icon" href="{$_theme}/images/logo.png" type="image/x-icon" />
<!-- Icons -->
<link rel="stylesheet" href="{$_theme}/fonts/ionicons/css/ionicons.min.css">
<link rel="stylesheet" href="{$_theme}/fonts/font-awesome/css/font-awesome.min.css">
<!-- Plugins -->
<link rel="stylesheet" href="{$_theme}/styles/plugins/waves.css">
<link rel="stylesheet" href="{$_theme}/styles/plugins/perfect-scrollbar.css">
<!-- Css/Less Stylesheets -->
<link rel="stylesheet" href="{$_theme}/styles/bootstrap.min.css">
<link rel="stylesheet" href="{$_theme}/styles/main.min.css">
<!-- Match Media polyfill for IE9 -->
<!--[if IE 9]> <script src="{$_theme}/scripts/ie/matchMedia.js"></script> <![endif]-->
</head>
<body id="app" class="app off-canvas body-full">
<div class="main-container clearfix">
<div class="content-container" id="content">
<div class="page page-auth">
<div class="auth-container">
<div class="form-head mb20">
<h1 class="site-logo h2 mb5 mt5 text-center text-uppercase text-bold">{$_L['Logo']}</h1>
<h5 class="text-normal h5 text-center">{$_L['Sign_In_Admin']}</h5>
</div>
{if isset($notify)}
{$notify}
{/if}
<div class="form-container">
<form class="form-horizontal" action="{$_url}admin/post" method="post">
<div class="md-input-container md-float-label">
<input type="text" name="username" class="md-input">
<label>{$_L['Username']}</label>
</div>
<div class="md-input-container md-float-label">
<input type="password" name="password" class="md-input">
<label>{$_L['Password']}</label>
</div>
<div class="clearfix">
<div class="ui-checkbox ui-checkbox-primary right">
<label>
<input type="checkbox">
<span>Remember me</span>
</label>
</div>
</div>
<div class="btn-group btn-group-justified mb15">
<div class="btn-group">
<button type="submit" class="btn btn-success">{$_L['Login']}</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<script src="scripts/vendors.js"></script>
</body>
</html>

View File

@ -2,7 +2,7 @@
<div class="row">
<div class="col-sm-12 col-md-12">
<div class="panel panel-default panel-hovered panel-stacked mb30">
<div class="panel panel-primary panel-hovered panel-stacked mb30">
<div class="panel-heading">{$_L['Localisation']}</div>
<div class="panel-body">

View File

@ -1,22 +1,32 @@
{include file="sections/header.tpl"}
<form class="form-horizontal" method="post" role="form" action="{$_url}settings/app-post" >
<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-default panel-hovered panel-stacked mb30">
<div class="panel panel-primary panel-hovered panel-stacked mb30">
<div class="panel-heading">{$_L['General_Settings']}</div>
<div class="panel-body">
<div class="form-group">
<label class="col-md-2 control-label">{$_L['App_Name']}</label>
<div class="col-md-6">
<input type="text" required class="form-control" id="company" name="company" value="{$_c['CompanyName']}">
<input type="text" required class="form-control" id="company" name="company"
value="{$_c['CompanyName']}">
<span class="help-block">{$_L['App_Name_Help_Text']}</span>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Company Footer')}</label>
<div class="col-md-6">
<input type="text" required class="form-control" id="footer" name="footer"
value="{$_c['CompanyFooter']}">
<span class="help-block">{Lang::T('Will show below user pages')}</span>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Address']}</label>
<div class="col-md-6">
<textarea class="form-control" id="address" name="address" rows="3">{$_c['address']}</textarea>
<textarea class="form-control" id="address" name="address"
rows="3">{Lang::htmlspecialchars($_c['address'])}</textarea>
<span class="help-block">{$_L['You_can_use_html_tag']}</span>
</div>
</div>
@ -34,7 +44,8 @@
<option value="1" {if $_c['radius_mode']}selected="selected" {/if}>Yes</option>
</select>
<p class="help-block">Still on Testing.</p>
<p class="help-block">Changing from Radius will not add existing user to Mikrotik Hotspot.</p>
<p class="help-block">Changing from Radius will not add existing user to Mikrotik Hotspot.
</p>
<p class="help-block">With Radius user can use Hotspot or PPOE.</p>
</div>
</div>
@ -51,33 +62,73 @@
<div class="form-group">
<label class="col-md-2 control-label">Telegram Bot Token</label>
<div class="col-md-6">
<input type="text" class="form-control" id="telegram_bot" name="telegram_bot" value="{$_c['telegram_bot']}" placeholder="123456:asdasgdkuasghddlashdashldhalskdklasd">
<input type="text" class="form-control" id="telegram_bot" name="telegram_bot"
value="{$_c['telegram_bot']}" placeholder="123456:asdasgdkuasghddlashdashldhalskdklasd">
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">Telegram Target ID</label>
<div class="col-md-6">
<input type="text" class="form-control" id="telegram_target_id" name="telegram_target_id" value="{$_c['telegram_target_id']}" placeholder="12345678">
<input type="text" class="form-control" id="telegram_target_id" name="telegram_target_id"
value="{$_c['telegram_target_id']}" placeholder="12345678">
</div>
</div>
<small id="emailHelp" class="form-text text-muted">You will get Payment and Error notification</small>
</div>
<div class="panel-heading">SMS OTP Registration</div>
<div class="panel-body">
<div class="form-group">
<label class="col-md-2 control-label">SMS Server URL</label>
<div class="col-md-6">
<input type="text" class="form-control" id="sms_url" name="sms_url" value="{$_c['sms_url']}" placeholder="https://domain/?param_number=[number]&param_text=[text]&secret=">
<p class="help-block">Must include <b>[text]</b> &amp; <b>[number]</b>, it will be replaced.</p>
<input type="text" class="form-control" id="sms_url" name="sms_url" value="{$_c['sms_url']}"
placeholder="https://domain/?param_number=[number]&param_text=[text]&secret=">
<p class="help-block">Must include <b>[text]</b> &amp; <b>[number]</b>, it will be replaced.
</p>
</div>
</div>
<small id="emailHelp" class="form-text text-muted">You can use WhatsApp in here too. <a href="https://wa.nux.my.id/login" target="_blank">Free Server</a></small>
</div>
<div class="panel-heading">Whatsapp Notification</div>
<div class="panel-body">
<div class="form-group">
<label class="col-md-2 control-label">Whatsapp Server URL</label>
<div class="col-md-6">
<input type="text" class="form-control" id="wa_url" name="wa_url" value="{$_c['wa_url']}" placeholder="https://domain/?param_number=[number]&param_text=[text]&secret=">
<p class="help-block">Must include <b>[text]</b> &amp; <b>[number]</b>, it will be replaced.</p>
<input type="text" class="form-control" id="wa_url" name="wa_url" value="{$_c['wa_url']}"
placeholder="https://domain/?param_number=[number]&param_text=[text]&secret=">
<p class="help-block">Must include <b>[text]</b> &amp; <b>[number]</b>, it will be replaced.
</p>
</div>
</div>
</div>
<div class="panel-heading">{Lang::T('User Notification')}</div>
<div class="panel-body">
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Expired Notification')}</label>
<div class="col-md-6">
<select name="user_notification_expired" id="user_notification_expired" class="form-control">
<option value="none">None</option>
<option value="wa" {if $_c['user_notification_expired'] == 'wa'}selected="selected" {/if}>Whatsapp</option>
<option value="sms" {if $_c['user_notification_expired'] == 'sms'}selected="selected" {/if}>SMS</option>
</select>
<p class="help-block">{Lang::T('User will get notification when package expired')}</p>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Expired Notification Message')}</label>
<div class="col-md-6">
<textarea class="form-control" id="user_notification_expired_text" name="user_notification_expired_text" placeholder="Hello [[name]], your internet package [[package]] has been expired" rows="3">{if $_c['user_notification_expired_text']!=''}{Lang::htmlspecialchars($_c['user_notification_expired_text'])}{else}Hello [[name]], your internet package [[package]] has been expired.{/if}</textarea>
<p class="help-block">{Lang::T('<b>[[name]]</b> will be replaced with Customer Name. <b>[[package]]</b> will be replaced with Package name.')}</p>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Payment Notification')}</label>
<div class="col-md-6">
<select name="user_notification_payment" id="user_notification_payment" class="form-control">
<option value="none">None</option>
<option value="wa" {if $_c['user_notification_payment'] == 'wa'}selected="selected" {/if}>Whatsapp</option>
<option value="sms" {if $_c['user_notification_payment'] == 'sms'}selected="selected" {/if}>SMS</option>
</select>
<p class="help-block">{Lang::T('User will get invoice notification when buy package or package refilled')}</p>
</div>
</div>
</div>
@ -86,7 +137,8 @@
<div class="form-group">
<label class="col-md-2 control-label">https://tawk.to/chat/</label>
<div class="col-md-6">
<input type="text" class="form-control" id="tawkto" name="tawkto" value="{$_c['tawkto']}" placeholder="62f1ca7037898912e961f5/1ga07df">
<input type="text" class="form-control" id="tawkto" name="tawkto" value="{$_c['tawkto']}"
placeholder="62f1ca7037898912e961f5/1ga07df">
<p class="help-block">From Direct Chat Link.</p>
<pre>/ip hotspot walled-garden
add dst-host=tawk.to
@ -99,21 +151,22 @@ add dst-host=*.tawk.to</pre>
<div class="form-group">
<label class="col-md-2 control-label">Note Invoice</label>
<div class="col-md-6">
<textarea class="form-control" id="note" name="note" rows="3">{$_c['note']}</textarea>
<textarea class="form-control" id="note" name="note" rows="3">{Lang::htmlspecialchars($_c['note'])}</textarea>
<span class="help-block">{$_L['You_can_use_html_tag']}</span>
</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>
<button class="btn btn-primary waves-effect waves-light"
type="submit">{$_L['Save']}</button>
</div>
</div>
</div>
<pre>/ip hotspot walled-garden
<pre>/ip hotspot walled-garden
add dst-host={$_domain}
add dst-host=*.{$_domain}</pre>
</div>
</div>
</div>
</form>
{include file="sections/footer.tpl"}
{include file="sections/footer.tpl"}

View File

@ -2,7 +2,7 @@
<div class="row">
<div class="col-sm-12 col-md-12">
<div class="panel panel-default panel-hovered panel-stacked mb30">
<div class="panel panel-primary panel-hovered panel-stacked mb30">
<div class="panel-heading">{$_L['Add_Bandwidth']}</div>
<div class="panel-body">

View File

@ -2,7 +2,7 @@
<div class="row">
<div class="col-sm-12 col-md-12">
<div class="panel panel-default panel-hovered panel-stacked mb30">
<div class="panel panel-primary panel-hovered panel-stacked mb30">
<div class="panel-heading">{$_L['Edit_Bandwidth']}</div>
<div class="panel-body">

View File

@ -2,7 +2,7 @@
<div class="row">
<div class="col-sm-12">
<div class="panel panel-hovered mb20 panel-default">
<div class="panel panel-hovered mb20 panel-primary">
<div class="panel-heading">{$_L['Bandwidth_Plans']}</div>
<div class="panel-body">
<div class="md-whiteframe-z1 mb20 text-center" style="padding: 15px">
@ -24,7 +24,7 @@
</div>&nbsp;
</div>
<div class="table-responsive">
<table class="table table-striped table-bordered">
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>{$_L['BW_Name']}</th>
@ -41,7 +41,7 @@
<td>{$ds['rate_up']} {$ds['rate_up_unit']}</td>
<td>
<a href="{$_url}bandwidth/edit/{$ds['id']}" class="btn btn-sm btn-warning">{$_L['Edit']}</a>
<a href="{$_url}bandwidth/delete/{$ds['id']}" id="{$ds['id']}" class="btn btn-danger btn-sm cdelete">{$_L['Delete']}</a>
<a href="{$_url}bandwidth/delete/{$ds['id']}" id="{$ds['id']}" class="btn btn-danger btn-sm" onclick="confirm('{$_L['Delete']}?')" >{$_L['Delete']}</a>
</td>
</tr>
{/foreach}

View File

@ -2,7 +2,7 @@
<div class="row">
<div class="col-sm-12 col-md-12">
<div class="panel panel-default panel-hovered panel-stacked mb30">
<div class="panel panel-primary panel-hovered panel-stacked mb30">
<div class="panel-heading">{$_L['Change_Password']}</div>
<div class="panel-body">
<form class="form-horizontal" method="post" role="form" action="{$_url}settings/change-password-post">

View File

@ -1,112 +1,160 @@
{include file="sections/header.tpl"}
<div class="row">
<div class="col-sm-6">
<div class="panel panel-hovered mb20 panel-default">
<div class="panel-heading">Discussions</div>
<div class="panel-body">Get help from community</div>
<div class="panel-footer">
<a href="https://github.com/ibnux/phpmixbill/discussions" target="_blank" class="btn btn-primary btn-lg btn-block"><i class="ion ion-chatboxes"></i> Chat Now</a>
</div>
</div>
</div>
<div class="col-sm-6">
<div class="panel panel-hovered mb20 panel-default">
<div class="panel-heading">Feedback</div>
<div class="panel-body">
Feedback and Bug Report
</div>
<div class="panel-footer">
<a href="https://github.com/ibnux/phpmixbill/issues" target="_blank" class="btn btn-primary btn-lg btn-block"><i class="ion ion-chatboxes"></i> Give Feedback</a>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="box box-hovered mb20 box-primary">
<div class="box-header">
<h3 class="box-title">Discussions</h3>
</div>
<div class="box-body">Get help from community</div>
<div class="box-footer">
<a href="https://github.com/hotspotbilling/phpnuxbill/discussions" target="_blank"
class="btn btn-primary btn-lg btn-block"><i class="ion ion-chatboxes"></i> Chat Now</a>
</div>
</div>
</div>
<div class="col-sm-6">
<div class="box box-hovered mb20 box-primary">
<div class="box-header">
<h3 class="box-title">Feedback</h3>
</div>
<div class="box-body">
Feedback and Bug Report
</div>
<div class="box-footer">
<a href="https://github.com/hotspotbilling/phpnuxbill/issues" target="_blank"
class="btn btn-primary btn-lg btn-block"><i class="ion ion-chatboxes"></i> Give Feedback</a>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="panel panel-hovered mb20 panel-default">
<div class="panel-heading">Donasi</div>
<div class="panel-body">Untuk pengembangan lebih baik, donasi ke iBNuX, donasi akan membantu terus pengembangan aplikasi</div>
<div class="table-responsive">
<table class="table table-bordered table-striped">
<tbody>
<tr>
<td>BCA</td>
<td>5410-454-825</td>
</tr>
<tr>
<td>Mandiri</td>
<td>163-000-1855-793</td>
</tr>
<tr>
<td>Atas nama</td>
<td>Ibnu Maksum</td>
</tr>
</tbody>
</table>
</div>
<div class="panel-footer">
<a href="https://trakteer.id/ibnux" target="_blank" class="btn btn-primary btn-lg btn-block">Trakteer</a>
<a href="https://karyakarsa.com/ibnux/support" target="_blank" class="btn btn-primary btn-lg btn-block">karyakarsa</a>
</div>
</div>
</div>
<div class="col-sm-6">
<div class="panel panel-hovered mb20 panel-default">
<div class="panel-heading">Donations</div>
<div class="panel-body">
Donations will help to continue phpmixbill development
</div>
<div class="table-responsive">
<table class="table table-bordered table-striped">
<tbody>
<tr>
<td>Bank Central Asia</td>
<td>5410-454-825</td>
</tr>
<tr>
<td>SWIFT/BIC</td>
<td>CENAIDJA</td>
</tr>
<tr>
<td>Jakarta</td>
<td>Indonesia</td>
</tr>
<tr>
<td>Account Name</td>
<td>Ibnu Maksum</td>
</tr>
</tbody>
</table>
</div>
<div class="panel-footer">
<a href="https://paypal.me/ibnux" target="_blank" class="btn btn-primary btn-lg btn-block">Paypal</a>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="panel panel-hovered mb20 panel-default">
<div class="panel-heading">Chat with me</div>
<div class="panel-body">Paid Support?<br>donation confirmation?<br>Or ask any Donation Alternative</div>
<div class="panel-footer">
<a href="https://t.me/ibnux" target="_blank" class="btn btn-primary btn-lg btn-block">Telegram</a>
<a href="https://twitter.com/messages/compose?recipient_id=20653807&text=Hello+i+am+phpmixbill+user" target="_blank" class="btn btn-primary btn-lg btn-block">Twitter</a>
<a href="https://m.me/ibnumaksum" target="_blank" class="btn btn-primary btn-lg btn-block">Facebook Messenger</a>
<a href="https://keybase.io/ibnux" target="_blank" class="btn btn-primary btn-lg btn-block">Keybase</a>
</div>
</div>
</div>
<div class="col-sm-6">
<div class="panel panel-default panel-hovered mb20 activities">
<div class="panel-heading">PHPMIXBILL</div>
<div class="panel-body">
{$_L['Welcome_Text_Admin']}
</div>
</div>
</div>
</div>
{include file="sections/footer.tpl"}
<div class="row">
<div class="col-sm-6">
<div class="box box-hovered mb20 box-primary">
<div class="box-header">
<h3 class="box-title">Donasi</h3>
</div>
<div class="box-body">Untuk pengembangan lebih baik, donasi ke iBNuX, donasi akan membantu terus
pengembangan aplikasi</div>
<div class="table-responsive">
<table class="table table-bordered table-striped">
<tbody>
<tr>
<td>BCA</td>
<td>5410-454-825</td>
</tr>
<tr>
<td>Mandiri</td>
<td>163-000-1855-793</td>
</tr>
<tr>
<td>Atas nama</td>
<td>Ibnu Maksum</td>
</tr>
</tbody>
</table>
</div>
<div class="box-footer">
<a href="https://trakteer.id/ibnux" target="_blank"
class="btn btn-primary btn-lg btn-block">Trakteer</a>
<a href="https://karyakarsa.com/ibnux/support" target="_blank"
class="btn btn-primary btn-lg btn-block">karyakarsa</a>
</div>
</div>
</div>
<div class="col-sm-6">
<div class="box box-hovered mb20 box-primary">
<div class="box-header">
<h3 class="box-title">Donations</h3>
</div>
<div class="box-body">
Donations will help to continue phpnuxbill development
</div>
<div class="table-responsive">
<table class="table table-bordered table-striped">
<tbody>
<tr>
<td>Bank Central Asia</td>
<td>5410-454-825</td>
</tr>
<tr>
<td>SWIFT/BIC</td>
<td>CENAIDJA</td>
</tr>
<tr>
<td>Jakarta</td>
<td>Indonesia</td>
</tr>
<tr>
<td>Account Name</td>
<td>Ibnu Maksum</td>
</tr>
</tbody>
</table>
</div>
<div class="box-footer">
<a href="https://paypal.me/ibnux" target="_blank" class="btn btn-primary btn-lg btn-block">Paypal</a>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="box box-hovered mb20 box-primary">
<div class="box-header">
<h3 class="box-title">Chat with me</h3>
</div>
<div class="box-body">Paid Support?<br>donation confirmation?<br>Or ask any Donation Alternative</div>
<div class="box-footer">
<a href="https://t.me/ibnux" target="_blank" class="btn btn-primary btn-lg btn-block">Telegram</a>
<a href="https://twitter.com/messages/compose?recipient_id=20653807&text=Hello+i+am+phpnuxbill+user"
target="_blank" class="btn btn-primary btn-lg btn-block">Twitter</a>
<a href="https://m.me/ibnumaksum" target="_blank" class="btn btn-primary btn-lg btn-block">Facebook
Messenger</a>
<a href="https://keybase.io/ibnux" target="_blank" class="btn btn-primary btn-lg btn-block">Keybase</a>
</div>
</div>
</div>
<div class="col-sm-6">
<div class="box box-primary box-hovered mb20 activities">
<div class="box-header">
<h3 class="box-title">PHPNUXBILL</h3>
</div>
<div class="box-body">
{$_L['Welcome_Text_Admin']}
</div>
<div class="box-footer" id="currentVersion">ver</div>
<div class="box-footer" id="latestVersion">ver</div>
<div class="box-footer">
<a href="https://github.com/hotspotbilling/phpnuxbill/releases" target="_blank"
class="btn btn-primary btn-lg btn-block">Get Latest Version</a>
</div>
</div>
<div class="box box-primary box-hovered mb20 activities">
<div class="box-header">
<h3 class="box-title">Free WhatsApp Gateway and Telegram Bot creater</h3>
</div>
<div class="box-body">
There is a Telegram bot wizard in here
</div>
<div class="box-footer">
<a href="https://wa.nux.my.id/login" target="_blank"
class="btn btn-primary btn-lg btn-block">wa.nux.my.id</a>
</div>
</div>
</div>
</div>
<script>
window.addEventListener('DOMContentLoaded', function() {
$.getJSON("./version.json?" + Math.random(), function(data) {
$('#currentVersion').html('Current Version: ' + data.version);
});
$.getJSON("https://raw.githubusercontent.com/hotspotbilling/phpnuxbill/master/version.json?" + Math
.random(),
function(data) {
$('#latestVersion').html('Latest Version: ' + data.version);
});
});
</script>
{include file="sections/footer.tpl"}

View File

@ -2,7 +2,7 @@
<div class="row">
<div class="col-sm-12 col-md-12">
<div class="panel panel-default panel-hovered panel-stacked mb30">
<div class="panel panel-primary panel-hovered panel-stacked mb30">
<div class="panel-heading">{$_L['Add_Contact']}</div>
<div class="panel-body">

View File

@ -2,7 +2,7 @@
<div class="row">
<div class="col-sm-12 col-md-12">
<div class="panel panel-default panel-hovered panel-stacked mb30">
<div class="panel panel-primary panel-hovered panel-stacked mb30">
<div class="panel-heading">{$_L['Edit_Contact']}</div>
<div class="panel-body">

View File

@ -2,7 +2,7 @@
<div class="row">
<div class="col-sm-12">
<div class="panel panel-hovered mb20 panel-default">
<div class="panel panel-hovered mb20 panel-primary">
<div class="panel-heading">{$_L['Manage_Accounts']}</div>
<div class="panel-body">
<div class="md-whiteframe-z1 mb20 text-center" style="padding: 15px">
@ -45,7 +45,7 @@
<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 cdelete">{$_L['Delete']}</a>
<a href="{$_url}customers/delete/{$ds['id']}" id="{$ds['id']}" class="btn btn-danger btn-sm" onclick="confirm('{$_L['Delete']}?')">{$_L['Delete']}</a>
</td>
</tr>
{/foreach}

View File

@ -1,215 +1,163 @@
{include file="sections/header.tpl"}
{if ($_admin['user_type']) eq 'Admin' || ($_admin['user_type']) eq 'Sales'}
<div class="row hidden">
<div class="col-md-12">
<div class="dash-head clearfix mt15 mb20">
<div class="left">
<h4 class="mb5 text-light">Dashboard</h4>
<p class="small"></p>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-3 col-sm-6">
<div class="panel panel-default mb20 mini-box panel-hovered">
<div class="panel-body">
<div class="clearfix">
<div class="info left">
<h4 class="mt0 text-primary text-bold">{$_c['currency_code']} {number_format($iday,0,$_c['dec_point'],$_c['thousands_sep'])}</h4>
<h5 class="text-light mb0">{$_L['Income_Today']}</h5>
</div>
<div class="right ion ion-ios-pricetags-outline icon"></div>
</div>
</div>
<div class="panel-footer clearfix panel-footer-sm panel-footer-primary">
<p class="mt0 mb0 right"><a class="text-putih" href="{$_url}reports/by-date">{$_L['View_Reports']}</a></p>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-3 col-xs-6">
<div class="small-box bg-aqua">
<div class="inner">
<h4><sup>{$_c['currency_code']}</sup>
{number_format($iday,0,$_c['dec_point'],$_c['thousands_sep'])}</h4>
<p>{$_L['Income_Today']}</p>
</div>
<div class="icon">
<i class="ion ion-bag"></i>
</div>
<a href="{$_url}reports/by-date" class="small-box-footer">{$_L['View_Reports']} <i
class="fa fa-arrow-circle-right"></i></a>
</div>
</div>
<div class="col-lg-3 col-xs-6">
<div class="small-box bg-green">
<div class="inner">
<h4><sup>{$_c['currency_code']}</sup>
{number_format($imonth,0,$_c['dec_point'],$_c['thousands_sep'])}</h4>
<div class="col-md-3 col-sm-6">
<div class="panel panel-default mb20 mini-box panel-hovered">
<div class="panel-body">
<div class="clearfix">
<div class="info left">
<h4 class="mt0 text-success text-bold">{$_c['currency_code']} {number_format($imonth,0,$_c['dec_point'],$_c['thousands_sep'])}</h4>
<h5 class="text-light mb0">{$_L['Income_This_Month']}</h5>
</div>
<div class="right ion ion-social-usd icon"></div>
</div>
</div>
<div class="panel-footer clearfix panel-footer-sm panel-footer-success">
<p class="mt0 mb0 right"><a class="text-putih" href="{$_url}reports/by-period">{$_L['View_Reports']}</a></p>
</div>
</div>
</div>
<p>{$_L['Income_This_Month']}</p>
</div>
<div class="icon">
<i class="ion ion-stats-bars"></i>
</div>
<a href="{$_url}reports/by-period" class="small-box-footer">{$_L['View_Reports']} <i
class="fa fa-arrow-circle-right"></i></a>
</div>
</div>
<div class="col-lg-3 col-xs-6">
<div class="small-box bg-yellow">
<div class="inner">
<h4>{$u_act}</h4>
<div class="col-md-3 col-sm-6">
<div class="panel panel-default mb20 mini-box panel-hovered">
<div class="panel-body">
<div class="clearfix">
<div class="info left">
<h4 class="mt0 text-info text-bold">{$u_act}</h4>
<h5 class="text-light mb0">{$_L['Users_Active']}</h5>
</div>
<div class="right ion ion-android-contact icon"></div>
</div>
</div>
<div class="panel-footer clearfix panel-footer-sm panel-footer-info">
<p class="mt0 mb0 right"><a class="text-putih" href="{$_url}prepaid/list">{$_L['View_All']}</a></p>
</div>
</div>
</div>
<p>{$_L['Users_Active']}</p>
</div>
<div class="icon">
<i class="ion ion-person"></i>
</div>
<a href="{$_url}prepaid/list" class="small-box-footer">{$_L['View_All']} <i
class="fa fa-arrow-circle-right"></i></a>
</div>
</div>
<div class="col-lg-3 col-xs-6">
<div class="small-box bg-red">
<div class="inner">
<h4>{$u_all}</h4>
<div class="col-md-3 col-sm-6">
<div class="panel panel-default mb20 mini-box panel-hovered">
<div class="panel-body">
<div class="clearfix">
<div class="info left">
<h4 class="mt0 text-pink text-bold">{$u_all}</h4>
<h5 class="text-light mb0">{$_L['Total_Users']}</h5>
</div>
<div class="right ion ion-android-contacts icon"></div>
</div>
</div>
<div class="panel-footer clearfix panel-footer-sm panel-footer-pink">
<p class="mt0 mb0 right"><a class="text-putih" href="{$_url}customers/list">{$_L['View_All']}</a></p>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-7">
<div class="panel panel-default mb20 panel-hovered project-stats table-responsive">
<div class="panel-heading">Vouchers Stock</div>
<div class="panel-body">
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>{$_L['Plan_Name']}</th>
<th>unused</th>
<th>used</th>
</tr>
</thead>
<tbody>
{foreach $plans as $stok}
<tr>
<td>{$stok['name_plan']}</td>
<td>{$stok['unused']}</td>
<td>{$stok['used']}</td>
</tr>
</tbody>
{/foreach}
<tr>
<td>Total</td>
<td>{$stocks['unused']}</td>
<td>{$stocks['used']}</td>
</tr>
</table>
</div>
</div>
</div>
<div class="panel panel-default mb20 panel-hovered project-stats table-responsive">
<div class="panel-heading">{$_L['User_Expired_Today']}</div>
<div class="panel-body">
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>Id</th>
<th>{$_L['Username']}</th>
<th>{$_L['Created_On']}</th>
<th>{$_L['Expires_On']}</th>
</tr>
</thead>
<tbody>
{$no = 1}
{foreach $expire as $expired}
<tr>
<td>{$no++}</td>
<td>{$expired['username']}</td>
<td>{date($_c['date_format'], strtotime($expired['recharged_on']))} {$expired['time']}</td>
<td>{date($_c['date_format'], strtotime($expired['expiration']))} {$expired['time']}</td>
</tr>
</tbody>
{/foreach}
</table>
</div>
</div>
</div>
</div>
<p>{$_L['Total_Users']}</p>
</div>
<div class="icon">
<i class="fa fa-users"></i>
</div>
<a href="{$_url}customers/list" class="small-box-footer">{$_L['View_All']} <i
class="fa fa-arrow-circle-right"></i></a>
</div>
</div>
</div>
<div class="col-md-5">
<div class="panel panel-default panel-hovered mb20 activities">
<div class="panel-heading">{Lang::T('Payment Gateway')}: {$_c['payment_gateway']}</div>
</div>
<div class="panel panel-default panel-hovered mb20 activities">
<div class="panel-heading">{$_L['Activity_Log']}</div>
<div class="panel-body">
<ul class="list-unstyled">
{foreach $dlog as $dlogs}
<li class="primary">
<span class="point"></span>
<span class="time small text-muted">{time_elapsed_string($dlogs['date'],true)}</span>
<p>{$dlogs['description']}</p>
</li>
{/foreach}
</ul>
</div>
</div>
</div>
<div class="row">
<div class="col-md-7">
<div class="panel panel-primary mb20 panel-hovered project-stats table-responsive">
<div class="panel-heading">Vouchers Stock</div>
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>{$_L['Plan_Name']}</th>
<th>unused</th>
<th>used</th>
</tr>
</thead>
<tbody>
{foreach $plans as $stok}
<tr>
<td>{$stok['name_plan']}</td>
<td>{$stok['unused']}</td>
<td>{$stok['used']}</td>
</tr>
</tbody>
{/foreach}
<tr>
<td>Total</td>
<td>{$stocks['unused']}</td>
<td>{$stocks['used']}</td>
</tr>
</table>
</div>
</div>
<div class="panel panel-warning mb20 panel-hovered project-stats table-responsive">
<div class="panel-heading">{$_L['User_Expired_Today']}</div>
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>Id</th>
<th>{$_L['Username']}</th>
<th>{$_L['Created_On']}</th>
<th>{$_L['Expires_On']}</th>
</tr>
</thead>
<tbody>
{$no = 1}
{foreach $expire as $expired}
<tr>
<td>{$no++}</td>
<td>{$expired['username']}</td>
<td>{date($_c['date_format'], strtotime($expired['recharged_on']))} {$expired['time']}
</td>
<td>{date($_c['date_format'], strtotime($expired['expiration']))} {$expired['time']}
</td>
</tr>
</tbody>
{/foreach}
</table>
</div>
</div>
</div>
</div>
{else}
<div class="row">
<div class="col-md-12">
<div class="dash-head clearfix mt15 mb20">
<div class="left">
<h4 class="mb5 text-light">{$_L['Welcome']}, {$_user['fullname']}</h4>
<p>{$_L['Welcome_Text_User']}</p>
<ul>
<li> {$_L['Account_Information']}</li>
<li> <a href="{$_url}voucher/activation">{$_L['Voucher_Activation']}</a></li>
<li> <a href="{$_url}voucher/list-activated">{$_L['List_Activated_Voucher']}</a></li>
<li> <a href="{$_url}accounts/change-password">{$_L['Change_Password']}</a></li>
<li> {$_L['Order_Voucher']}</li>
<li> {$_L['Private_Message']}</li>
</ul>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<div class="panel mb20 panel-primary panel-hovered">
<div class="panel-heading">{$_L['Account_Information']}</div>
<div class="panel-body">
<div class="row">
<div class="col-sm-3">
<p class="small text-success text-uppercase text-normal">{$_L['Username']}</p>
<p class="small mb15">{$_bill['username']}</p>
</div>
<div class="col-sm-3">
<p class="small text-primary text-uppercase text-normal">{$_L['Plan_Name']}</p>
<p class="small mb15">{$_bill['namebp']}</p>
</div>
<div class="col-sm-3">
<p class="small text-info text-uppercase text-normal">{$_L['Created_On']}</p>
<p class="small mb15">{date($_c['date_format'], strtotime($_bill['recharged_on']))} {$_bill['time']}</p>
</div>
<div class="col-sm-3">
<p class="small text-danger text-uppercase text-normal">{$_L['Expires_On']}</p>
<p class="small mb15">{date($_c['date_format'], strtotime($_bill['expiration']))} {$_bill['time']}</p>
</div>
</div>
<div class="col-md-5">
<div class="panel panel-success panel-hovered mb20 activities">
<div class="panel-heading">{Lang::T('Payment Gateway')}: {$_c['payment_gateway']}</div>
</div>
<div class="panel panel-info panel-hovered mb20 activities">
<div class="panel-heading">{$_L['Activity_Log']}</div>
<div class="panel-body">
<ul class="list-unstyled">
{foreach $dlog as $dlogs}
<li class="primary">
<span class="point"></span>
<span class="time small text-muted">{time_elapsed_string($dlogs['date'],true)}</span>
<p>{$dlogs['description']}</p>
</li>
{/foreach}
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{/if}
</div>
{include file="sections/footer.tpl"}
<script>
window.addEventListener('DOMContentLoaded', function() {
$.getJSON("./version.json?" + Math.random(), function(data) {
var localVersion = data.version;
$('#version').html('Version: ' + localVersion);
$.getJSON("https://raw.githubusercontent.com/ibnux/phpnuxbill/master/version.json?" + Math
.random(),
function(data) {
var latestVersion = data.version;
if (localVersion !== latestVersion) {
$('#version').html('Latest Version: ' + latestVersion);
}
});
});
});
</script>
{include file="sections/footer.tpl"}

Some files were not shown because too many files have changed in this diff Show More