Merge branch 'Development'

This commit is contained in:
Ibnu Maksum
2024-08-19 16:23:28 +07:00
47 changed files with 483 additions and 231 deletions

View File

@ -17,7 +17,7 @@ if (strpos($action, "-reset") !== false) {
_alert(Lang::T('You do not have permission to access this page'), 'danger', "dashboard");
}
$action = str_replace("-reset", "", $action);
$path = $PAGES_PATH . "/" . str_replace(".", "", $action) . ".html";
$path = "$PAGES_PATH/" . str_replace(".", "", $action) . ".html";
$temp = "pages_template/" . str_replace(".", "", $action) . ".html";
if (file_exists($temp)) {
if (!copy($temp, $path)) {
@ -31,7 +31,7 @@ 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");
}
$path = $PAGES_PATH . "/" . str_replace(".", "", $action) . ".html";
$path = "$PAGES_PATH/" . str_replace(".", "", $action) . ".html";
$ui->assign("action", $action);
//echo $path;
run_hook('view_edit_pages'); #HOOK
@ -47,13 +47,13 @@ if (strpos($action, "-reset") !== false) {
}
if (file_exists($path)) {
if ($action == 'Voucher') {
if (!file_exists($PAGES_PATH . "/vouchers/")) {
mkdir($PAGES_PATH . "/vouchers/");
if (!file_exists("$PAGES_PATH/vouchers/")) {
mkdir("$PAGES_PATH/vouchers/");
if (file_exists("pages_template/vouchers/")) {
File::copyFolder("pages_template/vouchers/", $PAGES_PATH . "/vouchers/");
File::copyFolder("pages_template/vouchers/", "$PAGES_PATH/vouchers/");
}
}
$ui->assign("vouchers", scandir($PAGES_PATH . "/vouchers/"));
$ui->assign("vouchers", scandir("$PAGES_PATH/vouchers/"));
}
$html = file_get_contents($path);
$ui->assign("htmls", str_replace(["<div", "</div>"], "", $html));
@ -68,14 +68,14 @@ if (strpos($action, "-reset") !== false) {
_alert(Lang::T('You do not have permission to access this page'), 'danger', "dashboard");
}
$action = str_replace("-post", "", $action);
$path = $PAGES_PATH . "/" . str_replace(".", "", $action) . ".html";
$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_PATH . "/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"));