Exemplo n.º 1
0
 /**
  * Function: decode
  *
  * Decodes the given XML node. The optional "into"
  * argument specifies an existing object to be
  * used. If no object is given, then a new instance
  * is created using the constructor from the codec.
  *
  * The function returns the passed in object or
  * the new instance if no object was given.
  *
  * Parameters:
  *
  * node - XML node to be decoded.
  * into - Optional object to be decodec into.
  */
 function decode($node, $into = null)
 {
     $obj = null;
     if (isset($node) && $node->nodeType == XML_ELEMENT_NODE) {
         $dec = mxCodecRegistry::getCodec($node->nodeName);
         try {
             if (isset($dec)) {
                 $obj = $dec->decode($this, $node, $into);
             } else {
                 $obj = $node->cloneNode(true);
                 $obj->removeAttribute("as");
             }
         } catch (Exception $ex) {
             // ignore
             mxLog::debug("Cannot decode " . $node->nodeName . ": {$ex}");
             throw $ex;
         }
     }
     return $obj;
 }
Exemplo n.º 2
0
 while (is_file($filename) && filesize($filename) == 0 && $count < $timeout && $_SESSION['requestid'] == $requestid) {
     sleep(1);
     clearstatcache();
     $count++;
     // Sync the session state
     session_start();
     session_commit();
 }
 // Sync the session state
 session_start();
 session_commit();
 if ($_SESSION['requestid'] != $requestid) {
     mxLog::debug("request {$requestid} has died");
 } else {
     if (filesize($filename) > 0) {
         mxLog::debug("request {$requestid} leaves: " . filesize($filename) . " bytes");
         header("Pragma: public");
         header("Expires: 0");
         header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
         header("Content-Type: application/xhtml+xml");
         // Sends the changes to the client
         echo "<message>";
         echo "<delta>";
         $fp = fopen($filename, "r+");
         fpassthru($fp);
         ftruncate($fp, 0);
         fflush($fp);
         fclose($fp);
         echo "</delta>";
         echo "</message>";
     } else {