diff --git a/twmap_gen/api/made.php b/twmap_gen/api/made.php index 36aa20e..66697f4 100644 --- a/twmap_gen/api/made.php +++ b/twmap_gen/api/made.php @@ -26,6 +26,8 @@ function my_error_out($msg){ global $log_channel; notify_web($log_channel,array("err:".$msg)); msglog("err:$msg"); + header("HTTP/1.0 400 Bad Request"); + printf("

%s

",print_r($msg,true)); exit(0); } function finish_task($param) { @@ -66,6 +68,7 @@ function finish_task($param) { msglog("notify web $log_channel with $mid"); notify_web($log_channel,array("finished!$mid")); + printf("

$okmsg

"); } diff --git a/twmap_gen/backend_make.php b/twmap_gen/backend_make.php index 4bd6943..d681381 100755 --- a/twmap_gen/backend_make.php +++ b/twmap_gen/backend_make.php @@ -185,6 +185,7 @@ $outx=0;$outy=0; $log_channel = $inp['formid']; +$dim = ""; $dim .= isset($inp['out57'])? '-D 5x7 ' : ''; $dim .= isset($inp['out46'])? '-D 4x6 ' : ''; $dim .= isset($inp['out34'])? '-D 3x4 ' : ''; @@ -219,7 +220,7 @@ $make_param_array=array('uid'=>$MYUID, 'limit'=>$user['limit'], 'recreate_flag'=> $recreate_flag, 'xx'=>$xx, 'yy'=>$yy, 'shiftx'=>$shiftx, 'shifty'=>$shifty, 'datum'=>isset($inp['97datum'])? "97":"67", 'version'=>$version,'title'=>$title, 'outimage'=>$outimage, -'$remote_ip'=> $_SERVER['REMOTE_ADDR'], 'log_channel'=>$log_channel, 'paper'=> isset($inp['a3_paper'])?'A3':'A4', 'cmd_param_key'=>$cmd_param_key ); +'remote_ip'=> $_SERVER['REMOTE_ADDR'], 'log_channel'=>$log_channel, 'paper'=> isset($inp['a3_paper'])?'A3':'A4', 'cmd_param_key'=>$cmd_param_key ); redis_set($log_channel, json_encode($make_param_array)); @@ -270,10 +271,12 @@ function msglog($str) { function _mb_mime_encode($string, $encoding) { + // https://www.php.net/manual/zh/function.mb-encode-mimeheader.php $pos = 0; // after 36 single bytes characters if then comes MB, it is broken // but I trimmed it down to 24, to stay 100% < 76 chars per line $split = 24; + $_string = ""; while ($pos < mb_strlen($string, $encoding)) { $output = mb_strimwidth($string, $pos, $split, "", $encoding); diff --git a/twmap_gen/cmd_make2.php b/twmap_gen/cmd_make2.php index c611fde..ec1f711 100755 --- a/twmap_gen/cmd_make2.php +++ b/twmap_gen/cmd_make2.php @@ -439,9 +439,9 @@ // log if (isset($opt['agent'])) $url.="&agent=".trim($opt['agent']); - cli_msglog("call callback api"); + cli_msglog("call callback api"); // $output = file_get_contents($url); - $cmd = sprintf("curl --connect-timeout 2 --max-time 30 --retry 10 --retry-max-time 0 %s",escapeshellarg($url)); + $cmd = sprintf("curl --fail-with-body --connect-timeout 2 --max-time 30 --retry 10 --retry-max-time 0 %s",escapeshellarg($url)); // 把 cmd 寫下來 $logger->debug($cmd); file_put_contents($outcmd,"\n\n$cmd\n",FILE_APPEND);