diff --git a/system/controllers/pages.php b/system/controllers/pages.php index 6dd8e73b..4e082c4f 100644 --- a/system/controllers/pages.php +++ b/system/controllers/pages.php @@ -1,4 +1,5 @@ assign('_system_menu', 'pages'); $action = $routes['1']; $ui->assign('_admin', $admin); -if(strpos($action,"-reset")!==false){ +if (strpos($action, "-reset") !== false) { 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); - $path = "pages/".str_replace(".","",$action).".html"; - $temp = "pages_template/".str_replace(".","",$action).".html"; - if(file_exists($temp)){ - if(!copy($temp, $path)){ - file_put_contents($path, Http::getData('https://raw.githubusercontent.com/hotspotbilling/phpnuxbill/master/pages_template/'.$action.'.html')); + $action = str_replace("-reset", "", $action); + $path = $PAGES_PATH . "/" . str_replace(".", "", $action) . ".html"; + $temp = "pages_template/" . str_replace(".", "", $action) . ".html"; + if (file_exists($temp)) { + if (!copy($temp, $path)) { + file_put_contents($path, Http::getData('https://raw.githubusercontent.com/hotspotbilling/phpnuxbill/master/pages_template/' . $action . '.html')); } - }else{ - file_put_contents($path, Http::getData('https://raw.githubusercontent.com/hotspotbilling/phpnuxbill/master/pages_template/'.$action.'.html')); + } else { + file_put_contents($path, Http::getData('https://raw.githubusercontent.com/hotspotbilling/phpnuxbill/master/pages_template/' . $action . '.html')); } - r2(U . 'pages/'.$action); -}else if(strpos($action,"-post")===false){ + r2(U . 'pages/' . $action); +} else if (strpos($action, "-post") === false) { 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); //echo $path; run_hook('view_edit_pages'); #HOOK - if(!file_exists($path)){ - $temp = "pages_template/".str_replace(".","",$action).".html"; - if(file_exists($temp)){ - if(!copy($temp, $path)){ + if (!file_exists($path)) { + $temp = "pages_template/" . str_replace(".", "", $action) . ".html"; + if (file_exists($temp)) { + if (!copy($temp, $path)) { touch($path); } - }else{ + } else { touch($path); } } - if(file_exists($path)){ - if($action=='Voucher'){ - if(!file_exists("pages/vouchers/")){ - mkdir("pages/vouchers/"); - if(file_exists("pages_template/vouchers/")){ - File::copyFolder("pages_template/vouchers/", "pages/vouchers/"); + if (file_exists($path)) { + if ($action == 'Voucher') { + if (!file_exists($PAGES_PATH . "/vouchers/")) { + mkdir($PAGES_PATH . "/vouchers/"); + if (file_exists("pages_template/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); - $ui->assign("htmls",str_replace([""],"",$html)); - $ui->assign("writeable",is_writable($path)); - $ui->assign("pageHeader",str_replace('_', ' ', $action)); - $ui->assign("PageFile",$action); + $ui->assign("htmls", str_replace([""], "", $html)); + $ui->assign("writeable", is_writable($path)); + $ui->assign("pageHeader", str_replace('_', ' ', $action)); + $ui->assign("PageFile", $action); $ui->display('page-edit.tpl'); - }else + } else $ui->display('a404.tpl'); -}else{ +} else { 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); - $path = "pages/".str_replace(".","",$action).".html"; - if(file_exists($path)){ + $action = str_replace("-post", "", $action); + $path = $PAGES_PATH . "/" . str_replace(".", "", $action) . ".html"; + if (file_exists($path)) { $html = _post("html"); run_hook('save_pages'); #HOOK - if(file_put_contents($path, $html)){ - if(_post('template_save')=='yes'){ - if(!empty(_post('template_name'))){ - file_put_contents("pages/vouchers/"._post('template_name').'.html', $html); + if (file_put_contents($path, $html)) { + if (_post('template_save') == 'yes') { + if (!empty(_post('template_name'))) { + file_put_contents($PAGES_PATH . "/vouchers/" . _post('template_name') . '.html', $html); } } - r2(U . 'pages/'.$action, 's', Lang::T("Saving page success")); - }else{ - r2(U . 'pages/'.$action, 'e', Lang::T("Failed to save page, make sure i can write to folder pages, chmod 664 pages/*.html")); + r2(U . 'pages/' . $action, 's', Lang::T("Saving page success")); + } else { + r2(U . 'pages/' . $action, 'e', Lang::T("Failed to save page, make sure i can write to folder pages, chmod 664 pages/*.html")); } - }else + } else $ui->display('a404.tpl'); -} \ No newline at end of file +} diff --git a/ui/ui/page-edit.tpl b/ui/ui/page-edit.tpl index a44bdd0c..fdd49287 100644 --- a/ui/ui/page-edit.tpl +++ b/ui/ui/page-edit.tpl @@ -31,7 +31,7 @@

{Lang::T("Sometimes you need to refresh 3 times until content change")}

+ value="{$app_url}/{$PAGES_PATH}/{$PageFile}.html"> {else} diff --git a/ui/ui/user-pages.tpl b/ui/ui/user-pages.tpl index 7d6bb8a9..f4fdf2bd 100644 --- a/ui/ui/user-pages.tpl +++ b/ui/ui/user-pages.tpl @@ -6,7 +6,7 @@
{$_L[$pageHeader]}
- {include file="$_path/../pages/$PageFile.html"} + {include file="$PAGES_PATH/$PageFile.html"}
diff --git a/ui/ui/user-selectGateway.tpl b/ui/ui/user-selectGateway.tpl index 6fd37475..701bf1a8 100644 --- a/ui/ui/user-selectGateway.tpl +++ b/ui/ui/user-selectGateway.tpl @@ -1,8 +1,16 @@ {include file="sections/user-header.tpl"}
-
-
+ {if file_exists("$PAGES_PATH/Payment_Info.html")} +
+
+
{Lang::T('Payment Info')}
+
{include file="$PAGES_PATH/Payment_Info.html"}
+
+
+ {/if} +
+
{Lang::T('Available Payment Gateway')}