diff --git a/system/controllers/order.php b/system/controllers/order.php index f8a2db2f..19aae154 100644 --- a/system/controllers/order.php +++ b/system/controllers/order.php @@ -403,7 +403,7 @@ switch ($action) { _log(Lang::T("Payment Gateway not set, please set it in Settings")); r2(U . "home", 'e', Lang::T("Failed to create Transaction..")); } - if (count($pgs) > 1) { + if (count($pgs) > 0) { $ui->assign('pgs', $pgs); if ($tax_enable === 'yes') { $ui->assign('tax', $tax); @@ -416,13 +416,9 @@ switch ($action) { $ui->display('user-ui/selectGateway.tpl'); break; } else { - if (empty($pgs[0])) { - sendTelegram("Payment Gateway not set, please set it in Settings"); - _log(Lang::T("Payment Gateway not set, please set it in Settings")); - r2(U . "home", 'e', Lang::T("Failed to create Transaction..")); - } else { - $_POST['gateway'] = $pgs[0]; - } + sendTelegram("Payment Gateway not set, please set it in Settings"); + _log(Lang::T("Payment Gateway not set, please set it in Settings")); + r2(U . "home", 'e', Lang::T("Failed to create Transaction..")); } case 'buy': $gateway = _post('gateway'); diff --git a/system/controllers/pages.php b/system/controllers/pages.php index 6dd8e73b..9b18fd1e 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(["
{Lang::T('Sometimes you need to refresh 3 times until content change')}
+ value="{$app_url}/{$PAGES_PATH}/{$PageFile}.html">