add payment info

This commit is contained in:
Ibnu Maksum 2024-08-19 11:48:06 +07:00
parent 1e0036465f
commit 66f0390288
No known key found for this signature in database
GPG Key ID: 7FC82848810579E5
6 changed files with 269 additions and 258 deletions

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/) * PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
* by https://t.me/ibnux * by https://t.me/ibnux
@ -11,76 +12,76 @@ $ui->assign('_system_menu', 'pages');
$action = $routes['1']; $action = $routes['1'];
$ui->assign('_admin', $admin); $ui->assign('_admin', $admin);
if(strpos($action,"-reset")!==false){ if (strpos($action, "-reset") !== false) {
if (!in_array($admin['user_type'], ['SuperAdmin', 'Admin'])) { if (!in_array($admin['user_type'], ['SuperAdmin', 'Admin'])) {
_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");
} }
$action = str_replace("-reset","",$action); $action = str_replace("-reset", "", $action);
$path = "pages/".str_replace(".","",$action).".html"; $path = $PAGES_PATH . "/" . str_replace(".", "", $action) . ".html";
$temp = "pages_template/".str_replace(".","",$action).".html"; $temp = "pages_template/" . str_replace(".", "", $action) . ".html";
if(file_exists($temp)){ if (file_exists($temp)) {
if(!copy($temp, $path)){ if (!copy($temp, $path)) {
file_put_contents($path, Http::getData('https://raw.githubusercontent.com/hotspotbilling/phpnuxbill/master/pages_template/'.$action.'.html')); file_put_contents($path, Http::getData('https://raw.githubusercontent.com/hotspotbilling/phpnuxbill/master/pages_template/' . $action . '.html'));
} }
}else{ } else {
file_put_contents($path, Http::getData('https://raw.githubusercontent.com/hotspotbilling/phpnuxbill/master/pages_template/'.$action.'.html')); file_put_contents($path, Http::getData('https://raw.githubusercontent.com/hotspotbilling/phpnuxbill/master/pages_template/' . $action . '.html'));
} }
r2(U . 'pages/'.$action); r2(U . 'pages/' . $action);
}else if(strpos($action,"-post")===false){ } else if (strpos($action, "-post") === false) {
if (!in_array($admin['user_type'], ['SuperAdmin', 'Admin'])) { if (!in_array($admin['user_type'], ['SuperAdmin', 'Admin'])) {
_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");
} }
$path = "pages/".str_replace(".","",$action).".html"; $path = $PAGES_PATH . "/" . str_replace(".", "", $action) . ".html";
$ui->assign("action", $action); $ui->assign("action", $action);
//echo $path; //echo $path;
run_hook('view_edit_pages'); #HOOK run_hook('view_edit_pages'); #HOOK
if(!file_exists($path)){ if (!file_exists($path)) {
$temp = "pages_template/".str_replace(".","",$action).".html"; $temp = "pages_template/" . str_replace(".", "", $action) . ".html";
if(file_exists($temp)){ if (file_exists($temp)) {
if(!copy($temp, $path)){ if (!copy($temp, $path)) {
touch($path); touch($path);
} }
}else{ } else {
touch($path); touch($path);
} }
} }
if(file_exists($path)){ if (file_exists($path)) {
if($action=='Voucher'){ if ($action == 'Voucher') {
if(!file_exists("pages/vouchers/")){ if (!file_exists($PAGES_PATH . "/vouchers/")) {
mkdir("pages/vouchers/"); mkdir($PAGES_PATH . "/vouchers/");
if(file_exists("pages_template/vouchers/")){ if (file_exists("pages_template/vouchers/")) {
File::copyFolder("pages_template/vouchers/", "pages/vouchers/"); File::copyFolder("pages_template/vouchers/", $PAGES_PATH . "/vouchers/");
} }
} }
$ui->assign("vouchers", scandir("pages/vouchers/")); $ui->assign("vouchers", scandir($PAGES_PATH . "/vouchers/"));
} }
$html = file_get_contents($path); $html = file_get_contents($path);
$ui->assign("htmls",str_replace(["<div","</div>"],"",$html)); $ui->assign("htmls", str_replace(["<div", "</div>"], "", $html));
$ui->assign("writeable",is_writable($path)); $ui->assign("writeable", is_writable($path));
$ui->assign("pageHeader",str_replace('_', ' ', $action)); $ui->assign("pageHeader", str_replace('_', ' ', $action));
$ui->assign("PageFile",$action); $ui->assign("PageFile", $action);
$ui->display('page-edit.tpl'); $ui->display('page-edit.tpl');
}else } else
$ui->display('a404.tpl'); $ui->display('a404.tpl');
}else{ } else {
if (!in_array($admin['user_type'], ['SuperAdmin', 'Admin'])) { if (!in_array($admin['user_type'], ['SuperAdmin', 'Admin'])) {
_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");
} }
$action = str_replace("-post","",$action); $action = str_replace("-post", "", $action);
$path = "pages/".str_replace(".","",$action).".html"; $path = $PAGES_PATH . "/" . str_replace(".", "", $action) . ".html";
if(file_exists($path)){ if (file_exists($path)) {
$html = _post("html"); $html = _post("html");
run_hook('save_pages'); #HOOK run_hook('save_pages'); #HOOK
if(file_put_contents($path, $html)){ if (file_put_contents($path, $html)) {
if(_post('template_save')=='yes'){ if (_post('template_save') == 'yes') {
if(!empty(_post('template_name'))){ if (!empty(_post('template_name'))) {
file_put_contents("pages/vouchers/"._post('template_name').'.html', $html); file_put_contents($PAGES_PATH . "/vouchers/" . _post('template_name') . '.html', $html);
} }
} }
r2(U . 'pages/'.$action, 's', Lang::T("Saving page success")); r2(U . 'pages/' . $action, 's', Lang::T("Saving page success"));
}else{ } else {
r2(U . 'pages/'.$action, 'e', Lang::T("Failed to save page, make sure i can write to folder pages, <i>chmod 664 pages/*.html<i>")); r2(U . 'pages/' . $action, 'e', Lang::T("Failed to save page, make sure i can write to folder pages, <i>chmod 664 pages/*.html<i>"));
} }
}else } else
$ui->display('a404.tpl'); $ui->display('a404.tpl');
} }

View File

@ -31,7 +31,7 @@
<br> <br>
<p class="help-block">{Lang::T("Sometimes you need to refresh 3 times until content change")}</p> <p class="help-block">{Lang::T("Sometimes you need to refresh 3 times until content change")}</p>
<input type="text" class="form-control" onclick="this.select()" readonly <input type="text" class="form-control" onclick="this.select()" readonly
value="{$app_url}/pages/{$PageFile}.html"> value="{$app_url}/{$PAGES_PATH}/{$PageFile}.html">
</div> </div>
{else} {else}
<div class="panel-footer"> <div class="panel-footer">
@ -54,10 +54,10 @@
{if $action=='Voucher'} {if $action=='Voucher'}
<div class="col-md-4"> <div class="col-md-4">
{foreach $vouchers as $v} {foreach $vouchers as $v}
{if is_file("pages/vouchers/$v")} {if is_file("$PAGES_PATH/vouchers/$v")}
<div class="panel mb20 panel-primary panel-hovered" style="cursor: pointer;" onclick="selectTemplate(this)"> <div class="panel mb20 panel-primary panel-hovered" style="cursor: pointer;" onclick="selectTemplate(this)">
<div class="panel-heading">{str_replace(".html", '', $v)}</div> <div class="panel-heading">{str_replace(".html", '', $v)}</div>
<div class="panel-body">{include file="pages/vouchers/$v"}</div> <div class="panel-body">{include file="$PAGES_PATH/vouchers/$v"}</div>
</div> </div>
{/if} {/if}
{/foreach} {/foreach}

View File

@ -473,6 +473,8 @@
</li> </li>
<li {if $_routes[1] eq 'Registration_Info' }class="active" {/if}><a <li {if $_routes[1] eq 'Registration_Info' }class="active" {/if}><a
href="{$_url}pages/Registration_Info">{Lang::T('Registration Info')}</a></li> href="{$_url}pages/Registration_Info">{Lang::T('Registration Info')}</a></li>
<li {if $_routes[1] eq 'Payment_Info' }class="active" {/if}><a
href="{$_url}pages/Payment_Info">{Lang::T('Payment Info')}</a></li>
<li {if $_routes[1] eq 'Privacy_Policy' }class="active" {/if}><a <li {if $_routes[1] eq 'Privacy_Policy' }class="active" {/if}><a
href="{$_url}pages/Privacy_Policy">{Lang::T('Privacy Policy')}</a></li> href="{$_url}pages/Privacy_Policy">{Lang::T('Privacy Policy')}</a></li>
<li {if $_routes[1] eq 'Terms_and_Conditions' }class="active" {/if}><a <li {if $_routes[1] eq 'Terms_and_Conditions' }class="active" {/if}><a
@ -600,4 +602,4 @@
} }
}); });
</script> </script>
{/if} {/if}

View File

@ -8,7 +8,7 @@
<h3 class="box-title">{Lang::T('Order Voucher')}</h3> <h3 class="box-title">{Lang::T('Order Voucher')}</h3>
</div> </div>
<div class="box-body"> <div class="box-body">
{include file="$_path/../pages/Order_Voucher.html"} {include file="$PAGES_PATH/Order_Voucher.html"}
</div> </div>
</div> </div>
</div> </div>

View File

@ -6,7 +6,7 @@
<div class="panel mb20 panel-primary panel-hovered"> <div class="panel mb20 panel-primary panel-hovered">
<div class="panel-heading">{$_L[$pageHeader]}</div> <div class="panel-heading">{$_L[$pageHeader]}</div>
<div class="panel-body"> <div class="panel-body">
{include file="$_path/../pages/$PageFile.html"} {include file="$PAGES_PATH/$PageFile.html"}
</div> </div>
</div> </div>
</div> </div>

View File

@ -1,8 +1,16 @@
{include file="sections/user-header.tpl"} {include file="sections/user-header.tpl"}
<div class="row"> <div class="row">
<div class="col-md-6 col-md-offset-3"> {if file_exists("$PAGES_PATH/Payment_Info.html")}
<div class="panel panel-info panel-hovered"> <div class="col-md-6">
<div class="panel panel-warning panel-hovered">
<div class="panel-heading">{Lang::T('Payment Info')}</div>
<div class="panel-body">{include file="$PAGES_PATH/Payment_Info.html"}</div>
</div>
</div>
{/if}
<div class="{if file_exists("$PAGES_PATH/Payment_Info.html")}col-md-6{else}col-md-6 col-md-offset-3{/if}">
<div class="panel panel-success panel-hovered">
<div class="panel-heading">{Lang::T('Available Payment Gateway')}</div> <div class="panel-heading">{Lang::T('Available Payment Gateway')}</div>
<div class="panel-footer"> <div class="panel-footer">
<form method="post" action="{$_url}order/buy/{$route2}/{$route3}"> <form method="post" action="{$_url}order/buy/{$route2}/{$route3}">