function openme_web_err($cfg, $tp, $err, $str) { if ($tp == 'json') { $a = array('return' => strval($err), 'error' => $str); $s = json_encode($a); } else { if ($tp == 'con') { $s = $str; } else { $tp = 'html'; $s = '<html><body><pre>' . $str . '</pre></html></body>'; } } return openme_web_out($cfg, $tp, $s, ''); }
$fr = true; } # Check if download if ($xt == 'web' && $fr || $act == 'pull' && $xt != 'json') { if (array_key_exists("file_content_base64", $rr)) { $x = $rr['file_content_base64']; } $fx = ''; if (array_key_exists("filename", $rr)) { $fx = $rr['filename']; } if ($fx == '') { $fx = 'ck-archive.zip'; } try { $bin = urlsafe_b64decode($x); } catch (Exception $e) { $er = "Internal CK web service error (" . $e->getMessage() . ")"; openme_web_err($cfg, $xt, 1, $er); exit(1); } # Process extension $xt = pathinfo($fx, PATHINFO_EXTENSION); } else { # If html mode and output file is empty, use stdout from module ... if (array_key_exists("html", $rr)) { $bin = $rr['html']; } } openme_web_out($cfg, $xt, $bin, $fx);