diff --git a/.htaccess_firewall b/.htaccess_firewall
index a58990b7..5d37c58f 100644
--- a/.htaccess_firewall
+++ b/.htaccess_firewall
@@ -6,4 +6,9 @@
Order Allow,Deny
Allow from all
+
+
+
+ Order Allow,Deny
+ Allow from all
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a0a3bf45..785537da 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,26 @@
# CHANGELOG
+## 2024.3.26
+
+- Change paginator, to make easy customization using pagination.tpl
+
+## 2024.3.25
+
+- Fix maps on HTTP
+- Fix Cancel payment
+
+## 2024.3.23
+
+- Maps full height
+- Show Get Directions instead Coordinates
+- Maps Label always show
+
+## 2024.3.22
+
+- Fix Broadcast Message by @Focuslinkstech
+- Add Location Picker
+
## 2024.3.20
- Fixing some bugs
diff --git a/install/phpnuxbill.sql b/install/phpnuxbill.sql
index 1bfed1c9..0d41fd30 100644
--- a/install/phpnuxbill.sql
+++ b/install/phpnuxbill.sql
@@ -21,7 +21,7 @@ CREATE TABLE `tbl_customers` (
`id` int(10) NOT NULL,
`username` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`password` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
- `pppoe_password` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '1' COMMENT 'For PPPOE Login',
+ `pppoe_password` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'For PPPOE Login',
`fullname` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`address` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci,
`phonenumber` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0',
diff --git a/system/autoload/Message.php b/system/autoload/Message.php
index 7e90176f..b4c3cccc 100644
--- a/system/autoload/Message.php
+++ b/system/autoload/Message.php
@@ -5,6 +5,12 @@
* by https://t.me/ibnux
**/
+use PHPMailer\PHPMailer\PHPMailer;
+use PHPMailer\PHPMailer\Exception;
+use PHPMailer\PHPMailer\SMTP;
+require $root_path . 'system/autoload/mail/Exception.php';
+require $root_path . 'system/autoload/mail/PHPMailer.php';
+require $root_path . 'system/autoload/mail/SMTP.php';
class Message
{
@@ -66,6 +72,44 @@ class Message
}
}
+ public static function sendEmail($to, $subject, $body)
+ {
+ global $config;
+ run_hook('send_email'); #HOOK
+ if (empty($config['smtp_host'])) {
+ $attr = "";
+ if (!empty($config['mail_from'])) {
+ $attr .= "From: " . $config['mail_from'] . "\r\n";
+ }
+ if (!empty($config['mail_reply_to'])) {
+ $attr .= "Reply-To: " . $config['mail_reply_to'] . "\r\n";
+ }
+ mail($to, $subject, $body, $attr);
+ } else {
+ $mail = new PHPMailer();
+ $mail->isSMTP();
+ $mail->SMTPDebug = SMTP::DEBUG_SERVER;
+ $mail->Host = $config['smtp_host'];
+ $mail->SMTPAuth = true;
+ $mail->Username = $config['smtp_user'];
+ $mail->Password = $config['smtp_pass'];
+ $mail->SMTPSecure = $config['smtp_ssltls'];
+ $mail->Port = $config['smtp_port'];
+ if (!empty($config['mail_from'])) {
+ $mail->setFrom($config['mail_from']);
+ }
+ if (!empty($config['mail_reply_to'])) {
+ $mail->addReplyTo($config['mail_reply_to']);
+ }
+ $mail->isHTML(false);
+ $mail->addAddress($to);
+ $mail->Subject = $subject;
+ $mail->Body = $body;
+ $mail->send();
+ die();
+ }
+ }
+
public static function sendPackageNotification($customer, $package, $price, $message, $via)
{
global $u;
@@ -73,7 +117,7 @@ class Message
$msg = str_replace('[[username]]', $customer['username'], $msg);
$msg = str_replace('[[package]]', $package, $msg);
$msg = str_replace('[[price]]', $price, $msg);
- if($u){
+ if ($u) {
$msg = str_replace('[[expired_date]]', Lang::dateAndTimeFormat($u['expiration'], $u['time']), $msg);
}
if (
diff --git a/system/autoload/Package.php b/system/autoload/Package.php
index de5ea9a4..af4a11d8 100644
--- a/system/autoload/Package.php
+++ b/system/autoload/Package.php
@@ -44,6 +44,7 @@ class Package
foreach ($bills as $k => $v) {
$note .= $k . " : " . Lang::moneyFormat($v) . "\n";
}
+ $note .= $p['name_plan'] . " : " . Lang::moneyFormat($p['price']) . "\n";
}
}
@@ -286,7 +287,7 @@ class Package
"\nRouter: " . $router_name .
"\nGateway: " . $gateway .
"\nChannel: " . $channel .
- "\nPrice: " . Lang::moneyFormat($p['price']) .
+ "\nPrice: " . Lang::moneyFormat($p['price'] + $add_cost) .
"\nNote:\n" . $note);
} else {
if ($p['is_radius']) {
@@ -374,7 +375,7 @@ class Package
"\nRouter: " . $router_name .
"\nGateway: " . $gateway .
"\nChannel: " . $channel .
- "\nPrice: " . Lang::moneyFormat($p['price']) .
+ "\nPrice: " . Lang::moneyFormat($p['price'] + $add_cost) .
"\nNote:\n" . $note);
}
} else {
@@ -481,7 +482,7 @@ class Package
"\nRouter: " . $router_name .
"\nGateway: " . $gateway .
"\nChannel: " . $channel .
- "\nPrice: " . Lang::moneyFormat($p['price']) .
+ "\nPrice: " . Lang::moneyFormat($p['price'] + $add_cost) .
"\nNote:\n" . $note);
} else {
if ($p['is_radius']) {
@@ -520,7 +521,9 @@ class Package
$t->plan_name = $p['name_plan'];
if ($p['validity_unit'] == 'Period') {
// Postpaid price always zero for first time
- $t->price = 0 + $add_cost;
+ $note = '';
+ $bills = [];
+ $t->price = 0;
} else {
$t->price = $p['price'] + $add_cost;
}
@@ -569,7 +572,7 @@ class Package
"\nRouter: " . $router_name .
"\nGateway: " . $gateway .
"\nChannel: " . $channel .
- "\nPrice: " . Lang::moneyFormat($p['price']) .
+ "\nPrice: " . Lang::moneyFormat($p['price'] + $add_cost) .
"\nNote:\n" . $note);
}
}
diff --git a/system/autoload/Paginator.php b/system/autoload/Paginator.php
index 53337202..24766ae6 100644
--- a/system/autoload/Paginator.php
+++ b/system/autoload/Paginator.php
@@ -1,14 +1,82 @@
0) {
+ $url .= '&' . http_build_query($search);
+ }
+ $url .= '&p=';
+ $totalReq = $query->count();
+ $next = $page + 1;
+ $lastpage = ceil($totalReq / $per_page);
+ $lpm1 = $lastpage - 1;
+ $limit = $per_page;
+ $startpoint = ($page * $limit) - $limit;
+ if ($lastpage >= 1) {
+ $pages = [];
+ if ($lastpage < 7 + ($adjacents * 2)) {
+ for ($counter = 1; $counter <= $lastpage; $counter++) {
+ $pages[] = $counter;
+ }
+ } elseif ($lastpage > 5 + ($adjacents * 2)) {
+ if ($page < 1 + ($adjacents * 2)) {
+ for ($counter = 1; $counter < 4 + ($adjacents * 2); $counter++) {
+ $pages[] = $counter;
+ }
+ $pages[] = "...";
+ $pages[] = $lpm1;
+ $pages[] = $lastpage;
+ } elseif ($lastpage - ($adjacents * 2) > $page && $page > ($adjacents * 2)) {
+ $pages[] = "1";
+ $pages[] = "2";
+ $pages[] = "...";
+ for ($counter = $page - $adjacents; $counter <= $page + $adjacents; $counter++) {
+ $pages[] = $counter;
+ }
+ $pages[] = "...";
+ $pages[] = $lpm1;
+ $pages[] = $lastpage;
+ } else {
+ $pages[] = "1";
+ $pages[] = "2";
+ $pages[] = "...";
+ for ($counter = $lastpage - (2 + ($adjacents * 2)); $counter <= $lastpage; $counter++) {
+ $pages[] = $counter;
+ }
+ }
+ }
+
+ $result = [
+ 'count' => $lastpage,
+ 'limit' => $per_page,
+ 'startpoint' => $startpoint,
+ 'url' => $url,
+ 'page' => $page,
+ 'pages' => $pages,
+ 'prev' => ($page > 0) ? ($page - 1) : "0",
+ 'next' => ($page >= $lastpage) ? $lastpage : $page + 1
+ ];
+ if ($ui) {
+ $ui->assign('paginator', $result);
+ }
+ return $query->offset($startpoint)->limit($per_page)->find_many();
+ }
+ }
+
+ public static function build($table, $colVal = [], $query = '', $per_page = '10')
{
global $routes;
global $_L;
@@ -17,13 +85,13 @@ class Paginator
$adjacents = "2";
$page = (int)(empty(_get('p')) ? 1 : _get('p'));
$pagination = "";
- foreach($colVal as $k=>$v) {
- if(!is_array($v) && strpos($v,'%') === false) {
+ foreach ($colVal as $k => $v) {
+ if (!is_array($v) && strpos($v, '%') === false) {
$table = $table->where($k, $v);
- }else{
- if(is_array($v)){
+ } else {
+ if (is_array($v)) {
$table = $table->where_in($k, $v);
- }else{
+ } else {
$table = $table->where_like($k, $v);
}
}
@@ -36,60 +104,60 @@ class Paginator
$limit = $per_page;
$startpoint = ($page * $limit) - $limit;
if ($lastpage >= 1) {
- $pagination .= '