Skip to content

Commit

Permalink
#76 bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
happyman committed Sep 28, 2023
1 parent 30de338 commit daddfd9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
3 changes: 3 additions & 0 deletions twmap_gen/api/made.php
Original file line number Diff line number Diff line change
Expand Up @@ -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("<h1>%s</h1>",print_r($msg,true));
exit(0);
}
function finish_task($param) {
Expand Down Expand Up @@ -66,6 +68,7 @@ function finish_task($param) {

msglog("notify web $log_channel with $mid");
notify_web($log_channel,array("finished!$mid"));
printf("<h1>$okmsg</h1>");
}


Expand Down
5 changes: 4 additions & 1 deletion twmap_gen/backend_make.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ' : '';
Expand Down Expand Up @@ -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));

Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions twmap_gen/cmd_make2.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit daddfd9

Please sign in to comment.