Merge branch 'Development' into TemplateRedesigned

This commit is contained in:
Ibnu Maksum
2024-08-19 11:49:22 +07:00
164 changed files with 12377 additions and 104 deletions

View File

@ -15,7 +15,7 @@ class Lang
if (empty($lan_file)) {
$lan_file = $root_path . File::pathFixer('system/lan/' . $config['language'] . '.json');
}
if (is_array($_SESSION['Lang'])) {
$_L = array_merge($_L, $_SESSION['Lang']);
}

View File

@ -153,8 +153,8 @@ switch ($action) {
$phoneFile = $otpPath . sha1($username . $db_pass) . "_phone.txt";
// expired 10 minutes
if (file_exists($otpFile) && time() - filemtime($otpFile) < 1200) {
r2(U . 'accounts/phone-update', 'e', Lang::T('Please wait ' . (1200 - (time() - filemtime($otpFile))) . ' seconds before sending another SMS'));
if (file_exists($otpFile) && time() - filemtime($otpFile) < 600) {
r2(U . 'accounts/phone-update', 'e', Lang::T('Please wait ' . (600 - (time() - filemtime($otpFile))) . ' seconds before sending another SMS'));
} else {
$otp = rand(100000, 999999);
file_put_contents($otpFile, $otp);

View File

@ -31,6 +31,7 @@ if(strpos($action,"-reset")!==false){
_alert(Lang::T('You do not have permission to access this page'),'danger', "dashboard");
}
$path = "pages/".str_replace(".","",$action).".html";
$ui->assign("action", $action);
//echo $path;
run_hook('view_edit_pages'); #HOOK
if(!file_exists($path)){
@ -44,6 +45,15 @@ if(strpos($action,"-reset")!==false){
}
}
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/");
}
}
$ui->assign("vouchers", scandir("pages/vouchers/"));
}
$html = file_get_contents($path);
$ui->assign("htmls",str_replace(["<div","</div>"],"",$html));
$ui->assign("writeable",is_writable($path));
@ -61,7 +71,12 @@ if(strpos($action,"-reset")!==false){
if(file_exists($path)){
$html = _post("html");
run_hook('save_pages'); #HOOK
if(file_put_contents($path, str_replace(["<div","</div>"],"",$html))){
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);
}
}
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, <i>chmod 664 pages/*.html<i>"));

View File

@ -124,9 +124,9 @@ switch ($do) {
}
$otpPath .= sha1($username . $db_pass) . ".txt";
//expired 10 minutes
if (file_exists($otpPath) && time() - filemtime($otpPath) < 1200) {
if (file_exists($otpPath) && time() - filemtime($otpPath) < 600) {
$ui->assign('username', $username);
$ui->assign('notify', 'Please wait ' . (1200 - (time() - filemtime($otpPath))) . ' seconds before sending another SMS');
$ui->assign('notify', 'Please wait ' . (600 - (time() - filemtime($otpPath))) . ' seconds before sending another SMS');
$ui->assign('notify_t', 'd');
$ui->display('user-ui/register-otp.tpl');
} else {