Merge branch 'master' of https://github.com/Focuslinkstech/phpnuxbill
This commit is contained in:
commit
0bcac10eec
@ -1,16 +1,18 @@
|
|||||||
<?php
|
<?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
|
|
||||||
$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://";
|
$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://";
|
||||||
$host = $_SERVER['HTTP_HOST'];
|
$host = $_SERVER['HTTP_HOST'];
|
||||||
$baseDir = rtrim(dirname($_SERVER['SCRIPT_NAME']), '/\\');
|
$baseDir = rtrim(dirname($_SERVER['SCRIPT_NAME']), '/\\');
|
||||||
define('APP_URL', $protocol . $host . $baseDir);
|
define('APP_URL', $protocol . $host . $baseDir);
|
||||||
#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
|
$_app_stage = 'Live'; # Do not change this
|
||||||
|
|
||||||
|
$db_host = "localhost"; # Database Host
|
||||||
|
$db_port = ""; # Database Port. Keep it blank if you are un sure.
|
||||||
|
$db_user = "root"; # Database Username
|
||||||
|
$db_pass = ""; # Database Password
|
||||||
|
$db_name = "phpnuxbill"; # Database Name
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
8
init.php
8
init.php
@ -67,10 +67,14 @@ require_once $root_path . File::pathFixer('system/orm.php');
|
|||||||
require_once $root_path . File::pathFixer('system/autoload/PEAR2/Autoload.php');
|
require_once $root_path . File::pathFixer('system/autoload/PEAR2/Autoload.php');
|
||||||
include $root_path . File::pathFixer('system/autoload/Hookers.php');
|
include $root_path . File::pathFixer('system/autoload/Hookers.php');
|
||||||
|
|
||||||
if(!empty($db_password)){
|
if($db_password != null && ($db_pass == null || empty($db_pass))){
|
||||||
// compability for old version
|
// compability for old version
|
||||||
$db_pass = $db_password;
|
$db_pass = $db_password;
|
||||||
}
|
}
|
||||||
|
if($db_pass != null){
|
||||||
|
// compability for old version
|
||||||
|
$db_password = $db_pass;
|
||||||
|
}
|
||||||
ORM::configure("mysql:host=$db_host;dbname=$db_name");
|
ORM::configure("mysql:host=$db_host;dbname=$db_name");
|
||||||
ORM::configure('username', $db_user);
|
ORM::configure('username', $db_user);
|
||||||
ORM::configure('password', $db_pass);
|
ORM::configure('password', $db_pass);
|
||||||
@ -329,7 +333,7 @@ function _alert($text, $type = 'success', $url = "home", $time = 3)
|
|||||||
|
|
||||||
|
|
||||||
if (!isset($api_secret)) {
|
if (!isset($api_secret)) {
|
||||||
$api_secret = $db_password;
|
$api_secret = $db_pass;
|
||||||
}
|
}
|
||||||
|
|
||||||
function displayMaintenanceMessage(): void
|
function displayMaintenanceMessage(): void
|
||||||
|
@ -9,14 +9,14 @@
|
|||||||
$appurl = $_POST['appurl'];
|
$appurl = $_POST['appurl'];
|
||||||
$db_host = $_POST['dbhost'];
|
$db_host = $_POST['dbhost'];
|
||||||
$db_user = $_POST['dbuser'];
|
$db_user = $_POST['dbuser'];
|
||||||
$db_password = $_POST['dbpass'];
|
$db_pass = $_POST['dbpass'];
|
||||||
$db_name = $_POST['dbname'];
|
$db_name = $_POST['dbname'];
|
||||||
$cn = '0';
|
$cn = '0';
|
||||||
try {
|
try {
|
||||||
$dbh = new pdo(
|
$dbh = new pdo(
|
||||||
"mysql:host=$db_host;dbname=$db_name",
|
"mysql:host=$db_host;dbname=$db_name",
|
||||||
"$db_user",
|
"$db_user",
|
||||||
"$db_password",
|
"$db_pass",
|
||||||
array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)
|
array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)
|
||||||
);
|
);
|
||||||
$cn = '1';
|
$cn = '1';
|
||||||
@ -39,13 +39,13 @@ $_app_stage = "Live";
|
|||||||
// Database PHPNuxBill
|
// Database PHPNuxBill
|
||||||
$db_host = "' . $db_host . '";
|
$db_host = "' . $db_host . '";
|
||||||
$db_user = "' . $db_user . '";
|
$db_user = "' . $db_user . '";
|
||||||
$db_pass = "' . $db_password . '";
|
$db_pass = "' . $db_pass . '";
|
||||||
$db_name = "' . $db_name . '";
|
$db_name = "' . $db_name . '";
|
||||||
|
|
||||||
// Database Radius
|
// Database Radius
|
||||||
$radius_host = "' . $db_host . '";
|
$radius_host = "' . $db_host . '";
|
||||||
$radius_user = "' . $db_user . '";
|
$radius_user = "' . $db_user . '";
|
||||||
$radius_pass = "' . $db_password . '";
|
$radius_pass = "' . $db_pass . '";
|
||||||
$radius_name = "' . $db_name . '";
|
$radius_name = "' . $db_name . '";
|
||||||
|
|
||||||
if($_app_stage!="Live"){
|
if($_app_stage!="Live"){
|
||||||
@ -70,7 +70,7 @@ $_app_stage = "Live";
|
|||||||
// Database PHPNuxBill
|
// Database PHPNuxBill
|
||||||
$db_host = "' . $db_host . '";
|
$db_host = "' . $db_host . '";
|
||||||
$db_user = "' . $db_user . '";
|
$db_user = "' . $db_user . '";
|
||||||
$db_pass = "' . $db_password . '";
|
$db_pass = "' . $db_pass . '";
|
||||||
$db_name = "' . $db_name . '";
|
$db_name = "' . $db_name . '";
|
||||||
|
|
||||||
if($_app_stage!="Live"){
|
if($_app_stage!="Live"){
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
try{
|
try{
|
||||||
$dbh = new pdo( "mysql:host=$db_host;dbname=$db_name",
|
$dbh = new pdo( "mysql:host=$db_host;dbname=$db_name",
|
||||||
"$db_user",
|
"$db_user",
|
||||||
"$db_password",
|
"$db_pass",
|
||||||
array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
|
array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
|
||||||
|
|
||||||
echo "CREATE TABLE `tbl_payment_gateway` (
|
echo "CREATE TABLE `tbl_payment_gateway` (
|
||||||
|
@ -11,7 +11,7 @@ class Admin
|
|||||||
|
|
||||||
public static function getID()
|
public static function getID()
|
||||||
{
|
{
|
||||||
global $db_password, $config;
|
global $db_pass, $config;
|
||||||
$enable_session_timeout = $config['enable_session_timeout'];
|
$enable_session_timeout = $config['enable_session_timeout'];
|
||||||
$session_timeout_duration = $config['session_timeout_duration'] * 60; // Convert minutes to seconds
|
$session_timeout_duration = $config['session_timeout_duration'] * 60; // Convert minutes to seconds
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ class Admin
|
|||||||
elseif (isset($_COOKIE['aid'])) {
|
elseif (isset($_COOKIE['aid'])) {
|
||||||
// id.time.sha1
|
// id.time.sha1
|
||||||
$tmp = explode('.', $_COOKIE['aid']);
|
$tmp = explode('.', $_COOKIE['aid']);
|
||||||
if (sha1($tmp[0] . '.' . $tmp[1] . '.' . $db_password) == $tmp[2]) {
|
if (sha1($tmp[0] . '.' . $tmp[1] . '.' . $db_pass) == $tmp[2]) {
|
||||||
if (time() - $tmp[1] < 86400 * 7) {
|
if (time() - $tmp[1] < 86400 * 7) {
|
||||||
$_SESSION['aid'] = $tmp[0];
|
$_SESSION['aid'] = $tmp[0];
|
||||||
if ($enable_session_timeout) {
|
if ($enable_session_timeout) {
|
||||||
@ -43,12 +43,12 @@ class Admin
|
|||||||
|
|
||||||
public static function setCookie($aid)
|
public static function setCookie($aid)
|
||||||
{
|
{
|
||||||
global $db_password, $config;
|
global $db_pass, $config;
|
||||||
$enable_session_timeout = $config['enable_session_timeout'];
|
$enable_session_timeout = $config['enable_session_timeout'];
|
||||||
$session_timeout_duration = $config['session_timeout_duration'] * 60; // Convert minutes to seconds
|
$session_timeout_duration = $config['session_timeout_duration'] * 60; // Convert minutes to seconds
|
||||||
if (isset($aid)) {
|
if (isset($aid)) {
|
||||||
$time = time();
|
$time = time();
|
||||||
$token = $aid . '.' . $time . '.' . sha1($aid . '.' . $time . '.' . $db_password);
|
$token = $aid . '.' . $time . '.' . sha1($aid . '.' . $time . '.' . $db_pass);
|
||||||
setcookie('aid', $token, time() + 86400 * 7);
|
setcookie('aid', $token, time() + 86400 * 7);
|
||||||
$_SESSION['aid'] = $aid;
|
$_SESSION['aid'] = $aid;
|
||||||
if ($enable_session_timeout) {
|
if ($enable_session_timeout) {
|
||||||
|
@ -29,6 +29,11 @@ class Package
|
|||||||
$isVoucher = false;
|
$isVoucher = false;
|
||||||
$c = [];
|
$c = [];
|
||||||
|
|
||||||
|
if($trx && $trx['status'] == 2){
|
||||||
|
// if its already paid, return it
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ($id_customer == '' or $router_name == '' or $plan_id == '') {
|
if ($id_customer == '' or $router_name == '' or $plan_id == '') {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -235,7 +240,7 @@ class Package
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($b['status'] == 'on') {
|
//if ($b['status'] == 'on') {
|
||||||
$dvc = Package::getDevice($p);
|
$dvc = Package::getDevice($p);
|
||||||
if ($_app_stage != 'demo') {
|
if ($_app_stage != 'demo') {
|
||||||
if (file_exists($dvc)) {
|
if (file_exists($dvc)) {
|
||||||
@ -245,7 +250,7 @@ class Package
|
|||||||
new Exception(Lang::T("Devices Not Found"));
|
new Exception(Lang::T("Devices Not Found"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
//}
|
||||||
|
|
||||||
$b->customer_id = $id_customer;
|
$b->customer_id = $id_customer;
|
||||||
$b->username = $c['username'];
|
$b->username = $c['username'];
|
||||||
|
@ -10,13 +10,13 @@ class User
|
|||||||
{
|
{
|
||||||
public static function getID()
|
public static function getID()
|
||||||
{
|
{
|
||||||
global $db_password;
|
global $db_pass;
|
||||||
if (isset($_SESSION['uid']) && !empty($_SESSION['uid'])) {
|
if (isset($_SESSION['uid']) && !empty($_SESSION['uid'])) {
|
||||||
return $_SESSION['uid'];
|
return $_SESSION['uid'];
|
||||||
} else if (isset($_COOKIE['uid'])) {
|
} else if (isset($_COOKIE['uid'])) {
|
||||||
// id.time.sha1
|
// id.time.sha1
|
||||||
$tmp = explode('.', $_COOKIE['uid']);
|
$tmp = explode('.', $_COOKIE['uid']);
|
||||||
if (sha1($tmp[0] . '.' . $tmp[1] . '.' . $db_password) == $tmp[2]) {
|
if (sha1($tmp[0] . '.' . $tmp[1] . '.' . $db_pass) == $tmp[2]) {
|
||||||
if (time() - $tmp[1] < 86400 * 30) {
|
if (time() - $tmp[1] < 86400 * 30) {
|
||||||
$_SESSION['uid'] = $tmp[0];
|
$_SESSION['uid'] = $tmp[0];
|
||||||
return $tmp[0];
|
return $tmp[0];
|
||||||
@ -159,10 +159,10 @@ class User
|
|||||||
|
|
||||||
public static function setCookie($uid)
|
public static function setCookie($uid)
|
||||||
{
|
{
|
||||||
global $db_password;
|
global $db_pass;
|
||||||
if (isset($uid)) {
|
if (isset($uid)) {
|
||||||
$time = time();
|
$time = time();
|
||||||
setcookie('uid', $uid . '.' . $time . '.' . sha1($uid . '.' . $time . '.' . $db_password), time() + 86400 * 30);
|
setcookie('uid', $uid . '.' . $time . '.' . sha1($uid . '.' . $time . '.' . $db_pass), time() + 86400 * 30);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,8 +149,8 @@ switch ($action) {
|
|||||||
mkdir($otpPath);
|
mkdir($otpPath);
|
||||||
touch($otpPath . 'index.html');
|
touch($otpPath . 'index.html');
|
||||||
}
|
}
|
||||||
$otpFile = $otpPath . sha1($username . $db_password) . ".txt";
|
$otpFile = $otpPath . sha1($username . $db_pass) . ".txt";
|
||||||
$phoneFile = $otpPath . sha1($username . $db_password) . "_phone.txt";
|
$phoneFile = $otpPath . sha1($username . $db_pass) . "_phone.txt";
|
||||||
|
|
||||||
// expired 10 minutes
|
// expired 10 minutes
|
||||||
if (file_exists($otpFile) && time() - filemtime($otpFile) < 1200) {
|
if (file_exists($otpFile) && time() - filemtime($otpFile) < 1200) {
|
||||||
@ -189,8 +189,8 @@ switch ($action) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($config['sms_url'])) {
|
if (!empty($config['sms_url'])) {
|
||||||
$otpFile = $otpPath . sha1($username . $db_password) . ".txt";
|
$otpFile = $otpPath . sha1($username . $db_pass) . ".txt";
|
||||||
$phoneFile = $otpPath . sha1($username . $db_password) . "_phone.txt";
|
$phoneFile = $otpPath . sha1($username . $db_pass) . "_phone.txt";
|
||||||
|
|
||||||
// Check if OTP file exists
|
// Check if OTP file exists
|
||||||
if (!file_exists($otpFile)) {
|
if (!file_exists($otpFile)) {
|
||||||
|
@ -55,9 +55,10 @@ if ($imonth == '') {
|
|||||||
}
|
}
|
||||||
$ui->assign('imonth', $imonth);
|
$ui->assign('imonth', $imonth);
|
||||||
|
|
||||||
|
if ($config['enable_balance'] == 'yes'){
|
||||||
$cb = ORM::for_table('tbl_customers')->whereGte('balance', 0)->sum('balance');
|
$cb = ORM::for_table('tbl_customers')->whereGte('balance', 0)->sum('balance');
|
||||||
|
|
||||||
$ui->assign('cb', $cb);
|
$ui->assign('cb', $cb);
|
||||||
|
}
|
||||||
|
|
||||||
$u_act = ORM::for_table('tbl_user_recharges')->where('status', 'on')->count();
|
$u_act = ORM::for_table('tbl_user_recharges')->where('status', 'on')->count();
|
||||||
if (empty($u_act)) {
|
if (empty($u_act)) {
|
||||||
|
@ -46,7 +46,7 @@ switch ($do) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($config['sms_url'])) {
|
if (!empty($config['sms_url'])) {
|
||||||
$otpPath .= sha1($username . $db_password) . ".txt";
|
$otpPath .= sha1($username . $db_pass) . ".txt";
|
||||||
run_hook('validate_otp'); #HOOK
|
run_hook('validate_otp'); #HOOK
|
||||||
//expired 10 minutes
|
//expired 10 minutes
|
||||||
if (file_exists($otpPath) && time() - filemtime($otpPath) > 1200) {
|
if (file_exists($otpPath) && time() - filemtime($otpPath) > 1200) {
|
||||||
@ -122,7 +122,7 @@ switch ($do) {
|
|||||||
mkdir($otpPath);
|
mkdir($otpPath);
|
||||||
touch($otpPath . 'index.html');
|
touch($otpPath . 'index.html');
|
||||||
}
|
}
|
||||||
$otpPath .= sha1($username . $db_password) . ".txt";
|
$otpPath .= sha1($username . $db_pass) . ".txt";
|
||||||
//expired 10 minutes
|
//expired 10 minutes
|
||||||
if (file_exists($otpPath) && time() - filemtime($otpPath) < 1200) {
|
if (file_exists($otpPath) && time() - filemtime($otpPath) < 1200) {
|
||||||
$ui->assign('username', $username);
|
$ui->assign('username', $username);
|
||||||
|
@ -701,7 +701,7 @@ switch ($action) {
|
|||||||
_alert(Lang::T('You do not have permission to access this page'), 'danger', "dashboard");
|
_alert(Lang::T('You do not have permission to access this page'), 'danger', "dashboard");
|
||||||
}
|
}
|
||||||
|
|
||||||
$dbc = new mysqli($db_host, $db_user, $db_password, $db_name);
|
$dbc = new mysqli($db_host, $db_user, $db_pass, $db_name);
|
||||||
if ($result = $dbc->query('SHOW TABLE STATUS')) {
|
if ($result = $dbc->query('SHOW TABLE STATUS')) {
|
||||||
$tables = array();
|
$tables = array();
|
||||||
while ($row = $result->fetch_array()) {
|
while ($row = $result->fetch_array()) {
|
||||||
|
@ -673,5 +673,10 @@
|
|||||||
"End_Date": "End Date",
|
"End_Date": "End Date",
|
||||||
"New_Version_Notification": "New Version Notification",
|
"New_Version_Notification": "New Version Notification",
|
||||||
"Enabled": "Enabled",
|
"Enabled": "Enabled",
|
||||||
"This_is_to_notify_you_when_new_updates_is_available": "This is to notify you when new updates is available"
|
"This_is_to_notify_you_when_new_updates_is_available": "This is to notify you when new updates is available",
|
||||||
|
"Enable_Session_Timeout": "Enable Session Timeout",
|
||||||
|
"Logout_Admin_if_not_Available_Online_a_period_of_time": "Logout Admin if not Available\/Online a period of time",
|
||||||
|
"Timeout_Duration": "Timeout Duration",
|
||||||
|
"Enter_the_session_timeout_duration__minutes_": "Enter the session timeout duration (minutes)",
|
||||||
|
"Idle_Timeout__Logout_Admin_if_Idle_for_xx_minutes": "Idle Timeout, Logout Admin if Idle for xx minutes"
|
||||||
}
|
}
|
@ -53,7 +53,7 @@
|
|||||||
<ol class="breadcrumb">
|
<ol class="breadcrumb">
|
||||||
<li>{Lang::dateFormat($start_date)}</li>
|
<li>{Lang::dateFormat($start_date)}</li>
|
||||||
<li>{Lang::dateFormat($current_date)}</li>
|
<li>{Lang::dateFormat($current_date)}</li>
|
||||||
{if in_array($_admin['user_type'],['SuperAdmin','Admin', 'Report'])}
|
{if $_c['enable_balance'] == 'yes' && in_array($_admin['user_type'],['SuperAdmin','Admin', 'Report'])}
|
||||||
<li>
|
<li>
|
||||||
{Lang::T('Customer Balance')} <sup>{$_c['currency_code']}</sup>
|
{Lang::T('Customer Balance')} <sup>{$_c['currency_code']}</sup>
|
||||||
<b>{number_format($cb,0,$_c['dec_point'],$_c['thousands_sep'])}</b>
|
<b>{number_format($cb,0,$_c['dec_point'],$_c['thousands_sep'])}</b>
|
||||||
@ -337,6 +337,9 @@
|
|||||||
//lets calculate the inactive users as reported
|
//lets calculate the inactive users as reported
|
||||||
var expired = u_all - u_act;
|
var expired = u_all - u_act;
|
||||||
var inactive = c_all - u_all;
|
var inactive = c_all - u_all;
|
||||||
|
if(inactive < 0){
|
||||||
|
inactive = 0;
|
||||||
|
}
|
||||||
// Create the chart data
|
// Create the chart data
|
||||||
var data = {
|
var data = {
|
||||||
labels: ['Active Users', 'Expired Users', 'Inactive Users'],
|
labels: ['Active Users', 'Expired Users', 'Inactive Users'],
|
||||||
|
@ -8,6 +8,11 @@
|
|||||||
session_start();
|
session_start();
|
||||||
include "config.php";
|
include "config.php";
|
||||||
|
|
||||||
|
if($db_password != null && ($db_pass == null || empty($db_pass))){
|
||||||
|
// compability for old version
|
||||||
|
$db_pass = $db_password;
|
||||||
|
}
|
||||||
|
|
||||||
if (empty($update_url)) {
|
if (empty($update_url)) {
|
||||||
$update_url = 'https://github.com/hotspotbilling/phpnuxbill/archive/refs/heads/master.zip';
|
$update_url = 'https://github.com/hotspotbilling/phpnuxbill/archive/refs/heads/master.zip';
|
||||||
}
|
}
|
||||||
@ -100,11 +105,10 @@ if (empty($step)) {
|
|||||||
}
|
}
|
||||||
} else if ($step == 4) {
|
} else if ($step == 4) {
|
||||||
if (file_exists("system/updates.json")) {
|
if (file_exists("system/updates.json")) {
|
||||||
require 'config.php';
|
|
||||||
$db = new pdo(
|
$db = new pdo(
|
||||||
"mysql:host=$db_host;dbname=$db_name",
|
"mysql:host=$db_host;dbname=$db_name",
|
||||||
$db_user,
|
$db_user,
|
||||||
$db_password,
|
$db_pass,
|
||||||
array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)
|
array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
{
|
{
|
||||||
"version": "2024.7.26"
|
"version": "2024.7.27"
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user