Skip to content

Commit

Permalink
v1.56.2
Browse files Browse the repository at this point in the history
  • Loading branch information
satopian committed Oct 31, 2024
1 parent 7186777 commit 532dae1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
7 changes: 4 additions & 3 deletions petitnote/functions.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
$functions_ver=20241031;
$functions_ver=20241101;
//編集モードログアウト
function logout(){
$resno=(int)filter_input(INPUT_GET,'resno',FILTER_VALIDATE_INT);
Expand Down Expand Up @@ -620,14 +620,15 @@ function delete_files ($imgfile, $time) {
safe_unlink(IMG_DIR.$time.'.tgkr');
delete_res_cache();
}

function delete_res_cache () {
safe_unlink(__DIR__.'/template/cache/index_cache.json');
}

//pngをwebpに変換してみてファイル容量が小さくなっていたら元のファイルを上書き
function convert_andsave_if_smaller_png2webp($is_upload,$dir,$fname,$time){
function convert_andsave_if_smaller_png2webp($is_upload,$fname,$time){
global $max_kb,$max_file_size_in_png_format_paint,$max_file_size_in_png_format_upload;
$upfile=TEMP_DIR.$fname;
$upfile=TEMP_DIR.basename($fname);

clearstatcache();
$filesize=filesize($upfile);
Expand Down
10 changes: 5 additions & 5 deletions petitnote/index.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
//Petit Note (c)さとぴあ @satopian 2021-2024
//1スレッド1ログファイル形式のスレッド式画像掲示板
$petit_ver='v1.56.0';
$petit_lot='lot.20241031';
$petit_ver='v1.56.2';
$petit_lot='lot.20241101';
$lang = ($http_langs = isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? $_SERVER['HTTP_ACCEPT_LANGUAGE'] : '')
? explode( ',', $http_langs )[0] : '';
$en= (stripos($lang,'ja')!==0);
Expand All @@ -16,7 +16,7 @@
return die(__DIR__.'/functions.php'.($en ? ' does not exist.':'がありません。'));
}
require_once(__DIR__.'/functions.php');
if(!isset($functions_ver)||$functions_ver<20241031){
if(!isset($functions_ver)||$functions_ver<20241101){
return die($en?'Please update functions.php to the latest version.':'functions.phpを最新版に更新してください。');
}
check_file(__DIR__.'/misskey_note.inc.php');
Expand Down Expand Up @@ -509,7 +509,7 @@ function post(){
thumb(TEMP_DIR,$time.'.tmp',$time,$max_px,$max_px,['toolarge'=>true]);
}
//サイズオーバの時に変換したwebpのほうがファイル容量が小さくなっていたら元のファイルを上書き
convert_andsave_if_smaller_png2webp($is_upload,TEMP_DIR,$time.'.tmp',$time);
convert_andsave_if_smaller_png2webp($is_upload,$time.'.tmp',$time);
if($is_upload){//アップロード画像のファイルサイズが大きすぎる時は削除
delete_file_if_sizeexceeds($upfile,$fp,$rp);
}
Expand Down Expand Up @@ -1374,7 +1374,7 @@ function img_replace(){
thumb(TEMP_DIR,$time.'.tmp',$time,$max_px,$max_px,['toolarge'=>true]);
}
//サイズオーバの時に変換したwebpのほうがファイル容量が小さくなっていたら元のファイルを上書き
convert_andsave_if_smaller_png2webp($is_upload,TEMP_DIR,$time.'.tmp',$time);
convert_andsave_if_smaller_png2webp($is_upload,$time.'.tmp',$time);

if($is_upload){//アップロード画像のファイルサイズが大きすぎる時は削除
delete_file_if_sizeexceeds($upfile,$fp,$rp);
Expand Down

0 comments on commit 532dae1

Please sign in to comment.