// we posted . characters, but something converts them to _ (HTTP 1.1 standard) $r = array(); foreach ($_REQUEST as $i => $v) { $r[join('.', explode('_', $i))] = $v; //convert _ back to . } $file = @$r['0']; $operatie = @$r['1']; $compiled = @$r['2']; if (@$r['3'] != '') { $error = @$r['3']; } else { $error = null; } $Actie = new Actie($ID, $file, $operatie, $compiled, $error); if ($Actie->save() !== false) { die('ok:' . serviceref($_REQUEST['content']) . '&Actie=' . urlencode($Actie->getId())); } else { die('Please fix errors!'); } exit; // do not show the interface } $buttons = ""; if (isset($_REQUEST['new'])) { $new = true; } else { $new = false; } if (isset($_REQUEST['edit']) || $new) { $edit = true;
// function shutdown ($running,$compileurl,$op) { // if($running){ // if ($compileurl=='NULL'){ // echo ('ok:<small><A href="JavaScript:compile(\''.$op.'\');">TIMEOUT ERROR. Nogmaals proberen?</A></small>'); // } else { // echo ('ok:<A HREF="'.$compileurl.'">TIMEOUT WARNING: Resultaat achter link is niet gegarandeerd. <IMG SRC="'.IMGPATH.'warning.png" /></A>'); // } // } // echo ('hold:op='.$op); // } // register_shutdown_function('shutdown',$running,$compileurl,$op); if (!is_dir($target)) { mkdir($target) or exit('error:could not create directory ' . $target); } $act = new Actie(null, $file->getId(), $op, false); if ($act->save() !== false) { // in linux: // exec(sprintf($opr->get_call(),$target,$source,$file->getId()).';touch '.COMPILATIONS_PATH.$op.'/done'); // but this has to be run on a windows machine, so: // |sort| is used as ; // type nul > is used as touch // (both methods work in linux as well) $str = '' . sprintf($opr->get_call(), $target, $source, $file->getId(), USER); //.' |sort| type nul > "'.$target.'done"'; $descriptorspec = array(0 => array("pipe", "r"), 1 => array("file", $target . "verbose.txt", "a"), 2 => array("file", $target . "error.txt", "a")); $process = proc_open($str, $descriptorspec, $pipes, getcwd()); if (is_resource($process)) { fclose($pipes[0]); //fclose($pipes[2]); //$perr = stream_get_contents($pipes[2]); //$pout = stream_get_contents($pipes[1]);