From 47915d6c49ffed4a527e04b0683106da606e23bc Mon Sep 17 00:00:00 2001 From: satopian Date: Sun, 24 Nov 2024 15:00:10 +0900 Subject: [PATCH] =?UTF-8?q?v6.53.0=20GD=E3=81=AE=E3=83=90=E3=83=BC?= =?UTF-8?q?=E3=82=B8=E3=83=A7=E3=83=B3=E3=83=81=E3=82=A7=E3=83=83=E3=82=AF?= =?UTF-8?q?=E3=82=92=E7=9C=81=E7=95=A5=E3=80=82GD=E3=81=8C=E4=BD=BF?= =?UTF-8?q?=E3=81=88=E3=82=8B=E3=81=8B=E3=81=A9=E3=81=86=E3=81=8B=E3=81=AE?= =?UTF-8?q?=E3=83=81=E3=82=A7=E3=83=83=E3=82=AF=E3=82=92=20thumbnail=5Fgd.?= =?UTF-8?q?inc.php=E3=81=AE=E3=82=AF=E3=83=A9=E3=82=B9=E5=86=85=E3=81=B8?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- potiboard5/potiboard.php | 50 +++++++-------------------------- potiboard5/thumbnail_gd.inc.php | 26 +++++++++++++++-- 2 files changed, 33 insertions(+), 43 deletions(-) diff --git a/potiboard5/potiboard.php b/potiboard5/potiboard.php index d218a065..1f779c35 100644 --- a/potiboard5/potiboard.php +++ b/potiboard5/potiboard.php @@ -3,8 +3,8 @@ // POTI-board EVO // バージョン : -const POTI_VER = 'v6.52.2'; -const POTI_LOT = 'lot.20241123'; +const POTI_VER = 'v6.53.0'; +const POTI_LOT = 'lot.20241124'; /* (C) 2018-2024 POTI改 POTI-board redevelopment team @@ -99,7 +99,7 @@ die($err); } require(__DIR__.'/thumbnail_gd.inc.php'); -if($thumbnail_gd_ver < 20241102){ +if($thumbnail_gd_ver < 20241124){ die($en ? "Please update thumbnail_gd.inc.php" : "thumbnail_gd.inc.phpを更新してください。"); } //SNS共有Class @@ -375,37 +375,8 @@ return redirect(h(PHP_SELF2)); } -exit; +exit(); -//GD版が使えるかチェック -function gd_check(){ - $check = array("ImageCreate","ImageCopyResized","ImageCreateFromJPEG","ImageJPEG","ImageDestroy"); - - //最低限のGD関数が使えるかチェック - if(!(get_gd_ver() && (ImageTypes() & IMG_JPG))){ - return false; - } - foreach ( $check as $cmd ) { - if(!function_exists($cmd)){ - return false; - } - } - return true; -} - -//gdのバージョンを調べる -function get_gd_ver(){ - if(function_exists("gd_info")){ - $gdver=gd_info(); - $phpinfo=(string)$gdver["GD Version"]; - $end=strpos($phpinfo,"."); - $phpinfo=substr($phpinfo,0,$end); - $length = strlen($phpinfo)-1; - $phpinfo=substr($phpinfo,$length); - return $phpinfo; - } - return false; -} //ユーザーip function get_uip(){ @@ -901,7 +872,7 @@ function error($mes,$dest=''){ $dat['mes'] = nl2br(h($mes)); htmloutput(OTHERFILE,$dat); - exit; + exit(); } // 文字列の類似性 @@ -2570,12 +2541,12 @@ function replace($no="",$pwd="",$repcode="",$java=""){ if(!trim($value)){ continue; } - list($eno,$edate,$name,$email,$sub,$com,$url,$ehost,$epwd,$ext,$_w,$_h,$etim,,$ptime,$fcolor,$epchext,$ethumbnail,$etool,$logver,) = explode(",", rtrim($value).',,,,,,,'); + list($eno,$edate,$name,$email,$sub,$com,$url,$ehost,$epwd,$ext,$_w,$_h,$etim,,$ptime,$fcolor,$epchext,$ethumbnail,$etool,$logver,) = explode(",", rtrim($value).',,,,,,,'); //画像差し換えに管理パスは使っていない - if($eno === $no && check_password($pwd, $epwd)){ - $flag = true; - break; - } + if($eno === $no && check_password($pwd, $epwd)){ + $flag = true; + break; + } } if(!$flag){ closeFile($fp); @@ -3647,7 +3618,6 @@ function create_line_from_treenumber ($fp,$trees){ return $line; } function make_thumbnail($imgfile,$time,$max_w,$max_h){ - global $use_thumb; $thumbnail=''; if(USE_THUMB){//スレッドの画像のサムネイルを使う時 if(thumbnail_gd::thumb(IMG_DIR,$imgfile,$time,$max_w,$max_h)){ diff --git a/potiboard5/thumbnail_gd.inc.php b/potiboard5/thumbnail_gd.inc.php index 022a878f..ba613104 100644 --- a/potiboard5/thumbnail_gd.inc.php +++ b/potiboard5/thumbnail_gd.inc.php @@ -3,7 +3,7 @@ // https://paintbbs.sakura.ne.jp/ // originalscript (C)SakaQ 2005 http://www.punyu.net/php/ -$thumbnail_gd_ver=20241117; +$thumbnail_gd_ver=20241124; defined('PERMISSION_FOR_DEST') or define('PERMISSION_FOR_DEST', 0606); //config.phpで未定義なら0606 class thumbnail_gd { @@ -15,7 +15,7 @@ public static function thumb($path,$fname,$time,$max_w,$max_h,$options=[]){ if(!is_file($fname)){ return; } - if(!gd_check()||!function_exists("ImageCreate")||!function_exists("ImageCreateFromJPEG")){ + if(!self::gd_check()||!function_exists("ImageCreate")||!function_exists("ImageCreateFromJPEG")){ return; } if((isset($options['webp'])||isset($options['thumbnail_webp'])) && !function_exists("ImageWEBP")){ @@ -46,7 +46,7 @@ public static function thumb($path,$fname,$time,$max_w,$max_h,$options=[]){ }; // 出力画像(サムネイル)のイメージを作成 $exists_ImageCopyResampled = false; - if(function_exists("ImageCreateTrueColor") && get_gd_ver()=="2"){ + if(function_exists("ImageCreateTrueColor")){ $im_out = ImageCreateTrueColor($out_w, $out_h); if(self::isTransparencyEnabled($options, $mime_type)){//透明度を扱う時 @@ -94,6 +94,26 @@ public static function thumb($path,$fname,$time,$max_w,$max_h,$options=[]){ return false; } + //GD版が使えるかチェック + private static function gd_check() { + // GDモジュールが有効化されているか + if (!extension_loaded('gd')) { + return false; + } + // GDモジュールが動作可能か + if (!function_exists('gd_info')) { + return false; + } + // JPEGのサポートを確認 + if (!(ImageTypes() & IMG_JPG)) { + return false; + } + // JPEG出力関数の存在を確認 + if (!function_exists('ImageJPEG')) { + return false; + } + return true; + } // 透明度の処理を行う必要があるかを判断 private static function isTransparencyEnabled($options, $mime_type) { // 透明度を扱うオプションが設定されているか確認