if (strncmp($sKey, "_", 1) != 0) { if (!isset($_POST[$sKey])) { $sXML .= "<arg id=\"" . trim($sKey) . "\">" . trim(htmlspecialchars($sValue)) . "</arg>"; } } } $sXML = "<args>" . $sXML . "</args>"; $oPending = new CRowtblpending(); $oPending->SetGroupId($nCommandGroup); $oPending->SetInTimestamp(date("Y-m-d H:i:s")); $oPending->SetInXML($sXML); $oPending->SetSource(0); $oPending->SetCompleted(2); $bError = !$oPending->Insert($oSession); if ($bError) { $sMessage = "<error><message>" . $oPending->GetErrorInfo() . "</message></error>"; } else { $nKey = $oPending->GetPendingId(); $nSleep = 0; do { if ($nSleep > 0) { sleep(1); } $oPending->Clear(); $oPending->SetPendingId($nKey); $oPending->Select($oSession); $nSleep++; } while ($nSleep < $nTimeout && $oPending->GetCompleted() != 1 && $oPending->GetCompleted() != 4); $bError = $nSleep == $nTimeout && $oPending->GetCompleted() != 1 && $oPending->GetCompleted() != 4; if ($bError) { $sMessage = "<error><message>Timeout</message></error>";