Skip to content

Commit

Permalink
削除処理のあとのLocationの分岐を既存の関数で処理して行数を減らす。
Browse files Browse the repository at this point in the history
  • Loading branch information
satopian committed Dec 15, 2024
1 parent 732d66d commit a222260
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
4 changes: 4 additions & 0 deletions petitnote/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ function set_darkmode(){
function branch_destination_of_location(){
$page=(int)filter_input(INPUT_POST,'postpage',FILTER_VALIDATE_INT);
$resno=(int)filter_input(INPUT_POST,'resno',FILTER_VALIDATE_INT);
$resno= $resno ? $resno : (int)filter_input(INPUT_POST,'postresno',FILTER_VALIDATE_INT);
$catalog=(bool)filter_input(INPUT_POST,'catalog',FILTER_VALIDATE_BOOLEAN);
$search=(bool)filter_input(INPUT_POST,'search',FILTER_VALIDATE_BOOLEAN);
$paintcom=(bool)filter_input(INPUT_POST,'paintcom',FILTER_VALIDATE_BOOLEAN);
Expand All @@ -238,6 +239,9 @@ function branch_destination_of_location(){
return header('Location: ./?mode=paintcom');
}
if($resno){
if(!is_file(LOG_DIR.$resno.'.log')){
return header('Location: ./');
}
$res_catalog = $res_catalog ? '&res_catalog=on' : '';
return header('Location: ./?resno='.h($resno).$res_catalog);
}
Expand Down
9 changes: 1 addition & 8 deletions petitnote/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -2064,15 +2064,8 @@ function del(){
closeFile($fp);

unset($_SESSION['userdel']);
$resno=(string)filter_input(INPUT_POST,'postresno',FILTER_VALIDATE_INT);
//多重送信防止
if((bool)filter_input(INPUT_POST,'resmode',FILTER_VALIDATE_BOOLEAN)){
if(!is_file(LOG_DIR.$resno.'.log')){
return header('Location: ./');
}
return header('Location: ./?resno='.$resno);
}
return header('Location: ./?page='.(int)filter_input(INPUT_POST,'postpage',FILTER_VALIDATE_INT));
branch_destination_of_location();
}

//シェアするserverの選択画面
Expand Down

0 comments on commit a222260

Please sign in to comment.